Some bugs that I can't figure out

BlitzMax Forums/BlitzMax Programming/Some bugs that I can't figure out

Pineapple(Posted 2007) [#1]
I've written a nice program that has a handful of features for particles and at least I think it's pretty fun to play with. However, it has a few minor bugs that I can't seem to get out. The program is far from complete.

A couple of my floats (made doubles for maximum accuracy) will, when set to 0, will instead show an almost random value such as 1.86 in one case.
I've tried to fix this but I'm not sure what's happening.

Controls-
m brings up the menu
arrow keys navigate menu and alter values
f toggles fire at mouse
g toggles smoke at mouse
s creates a sonic boom at mouse
r toggles rain

Comments on my program are also welcome, and ideas as well. I hope you think it's fun also, and note that the fireworks section of the menu is incomplete.




Jesse(Posted 2007) [#2]
I can't seem to figure out what it is that is supposed to do and is not. can you be more specific?

by the way those effects look nice.


N(Posted 2007) [#3]
It's because they aren't zero. You've reduced them to close to zero, but due to floating point numbers not being 100% accurate (they're close, but not perfect), you're getting a very, very, very, very, very small fraction. If it bothers you, check to see if the absolute value of the number is less than your chosen minimum difference/delta/epsilon (pick your term) and set it to zero when modifying numbers.


Pineapple(Posted 2007) [#4]
My problem is,

on rain edit menu, modfying wind speed gives odd results. I will havve declared it as a double equal to 0.2, but it shows up as 0.19 in the menu, and I can't fix it.

Rain gravity will go to 1.86 when I try to decrease the value while I'm at 0.01

Editing below 0 gravity for fireworks comes out with -0.0, there's probably another decimal after that but it don't work nonetheless.

Those are all the bugs I noticed. Here's the new code with the Fireworks menu almost complete.




FlameDuck(Posted 2007) [#5]
I will havve declared it as a double equal to 0.2, but it shows up as 0.19 in the menu, and I can't fix it.
No. Because it's not broken. You're just not showing enough decimals.

Rain gravity will go to 1.86 when I try to decrease the value while I'm at 0.01
Or it's using scientific notation, and you're printing the results incorrectly.


Brucey(Posted 2007) [#6]
Your rain wind is a Float... it's quite inaccurate, hence it "looks" wrong when you view it.
Your Rgrav is a Double, yet you are setting it with 0.05, which defaults to a Float. This starts your value with an amount that is less accurate than if you'd given it a double value to start with... eg. 0.05:Double
Also, you are incrementing and decrementing your Rgrav value with floats, which again leads to inaccuracies (albeit very small ones ;-)

As Mr Duck says, the reason it shows 1.86 is because the full, un-trimmed string is displayed as scientific.

You might also find you'll get better frame-rates by not drawing Ovals. Perhaps a scaled image is quicker..


Pineapple(Posted 2007) [#7]
My aim was to use no outside media, and I'm not too sure how pixmaps (if that's even what I'd use) work yet.

And thanks for the help, I'll try to correct that.