another stoopid thing. Auto Array problems....

BlitzMax Forums/BlitzMax Beginners Area/another stoopid thing. Auto Array problems....

Damien Sturdy(Posted 2004) [#1]
Hey peeps..
im having a few n00b problems again!!!

Local titlebar#[]=[x#,y#-titleheight#,x#+sizex#,y#-titleheight#,x#+sizex#,y#,x#,y#]


returns "auto arrays must contain similar types" or to that effect.

Also, if i do them all without floats, it gets past that line, but fails when i try to

drawpoly titlebar


complaining about mismatched float/ints.....
EEEK. help again ^.^ what am i doing wrong?


[edit]
i got it to work by using "float" with everything? can anyone shed some light on this?


FlameDuck(Posted 2004) [#2]
can anyone shed some light on this?
No. I got it to work by explicitly casting all the mathematical operations to Floats. It seems that adding to floats, returns a Double precision value. Try doing a Print y+x - way to many decimals there...

I reckon this is a bug.


Damien Sturdy(Posted 2004) [#3]
Well, considering you said you couldnt shed any light, you certainly managed to.. this is interesting. I'll be keeping my eye on this situation as its making my life kind of irritating... Oh well. if its returning doubles then that means its doing some kind of maths in double right? and doubles cause a slowdown? then this is a potential speed increase right here too.....

For now though im going to concentrate on how frustrating it is to be the total newbie :D


FlameDuck(Posted 2004) [#4]
Oh well. if its returning doubles then that means its doing some kind of maths in double right?
I think it's actually a matter of how it's pushing and pulling things off the FPU stack for floating point operations.


marksibly(Posted 2004) [#5]
Hi,

Yes, this is a bug - it's promoting float+float to double.

However, I would like to point out the double math is typically *not* slow! In fact, all FP math is done inside the CPU at 80 bit precision regardless of the 'source' of the operands. Float/double only affects how variables are stored in memory and passed to functions.

'Double is slow' has been put forward as a theory several times to explain away some speed anomilies, but has been disproved in all cases so far.

Finally, would you be so kind as to not title your topics 'this or that is stoopid'? It just isn't particularly encouraging my end.


Damien Sturdy(Posted 2004) [#6]
Sorry Mark.

Id like to say that 1) It's an honour to have you reply to my post and 2) the topic title was intended that i was being stupid and not that blitzmax is. Sorry for that mix up. Not particularly the best thing to do realy, anoy the creator of BlitzMax :)


That is some interesting insight there as to how doubles are done. Personally i lost my knowledge on the internal workings of processors and chipsets sine my BBC days :)