MinGW, Floats, 3impact and BlitzMax?

BlitzMax Forums/BlitzMax Programming/MinGW, Floats, 3impact and BlitzMax?

Amon(Posted 2007) [#1]
Hi! Below is a post I've made on the 3impact forums. I thought I'd post it here also in the event that it was a blitzmax MinGW issue or something to that effect.


Hi! I don't know why this happens so maybe someone more knowledgable than me can explain it to me. I have been noticing for a long time instability with my 3impact games and simulations. I would get severe slowdown, jittery physics and sometimes the game or simulation would completely bork up and stall.

Anyway, I managed to figure out why this was happening and it was so simple I couldn't believe it.

In all my code so far I've been using floats to store data such as gravity etc. The reason for all this instability as I've found out is using floats in this way eg. Float Gravity = 9.1

Now if I change that to "Float Gravity 9.11" the simulation smooths up a bit. Now, if I change all my floats to have at least 6-7 digits after the decimal eg. Float Gravity = 9.1111111 - the simulation runs flawlessly without problems.

This strange behaviour effects all commands. eg if all my other floats have atleast 7 digits after the decimal but I leave say a friction command to 3.4 then this weird jittery behaviour returns.

I'm wondering if this happens to any other 3impact/BlitzMax user? If not is there a reason why using long floats is better than using a a float set to only 1 digit after the decimal eg. 3.4?

Thanks.



I hope I'm ok posting this here?

:)


errno!(Posted 2007) [#2]
If in doubt, Blame Blitz. :)

Sorry nothing constructive, but it wouldn't be the first ungodly wierd bug i've come across using blitz.


Gabriel(Posted 2007) [#3]
What if you make gravity 9.0000001 which would actually be much closer to your intended value?


Amon(Posted 2007) [#4]
Yeah I should have posted that i sorted the problem but forgot about this thread.

It was to do with physics accuracy where 9.0 isn't as smooth as 9.98560 or 9.000011 etc .

:)