Mythruna

Development => Blog => Topic started by: pspeed on September 15, 2013, 11:15:17 PM



Title: Why coding is "fun"...
Post by: pspeed on September 15, 2013, 11:15:17 PM
A short story...

Five or so hours of debugging boil down to a one line fix in jMonkeyEngine.

Essentially, I changed:
a > b * c
to
a / b > c

Mathematically equivalent for positive b... but not so equivalent in floating point.

But you will all be happier when your in-inventory objects don't magically fall through the back of your inventory grid in certain locations.


Title: Re: Why coding is "fun"...
Post by: Iggyjeckel on September 15, 2013, 11:45:51 PM
But those are those lovely aha moments, like searching everywhere for an hour because something isn't working correctly to find that you forgot a stupid semi colon. Or messed up the for loop by one number.



Title: Re: Why coding is "fun"...
Post by: pspeed on September 15, 2013, 11:57:00 PM
...no, this was adding ever deeper debug logging and running the application over and over again to generate output.  Once the problem was isolated then I had to sort out what the math was supposed to do and why it wasn't doing it in this case.  The floating point error was even in the last decimal place. ;)

If you are really curious, you can drill in on the diff here:
http://code.google.com/p/jmonkeyengine/source/detail?r=10785

The comment is 100x longer than the fix. :)


Title: Re: Why coding is "fun"...
Post by: Iggyjeckel on September 16, 2013, 11:52:21 AM
I was just commenting on some of my joys while programming.


Title: Re: Why coding is "fun"...
Post by: pspeed on September 16, 2013, 03:06:15 PM
I was just commenting on some of my joys while programming.

Heheh... yeah.  I like aha moments.  I don't really like the "find the needle in the haystack and then put all the hay pieces back where you found them."  :)


Title: Re: Why coding is "fun"...
Post by: ebag51 on September 16, 2013, 04:55:20 PM
A short story...

Five or so hours of debugging boil down to a one line fix in jMonkeyEngine.

Essentially, I changed:
a > b * c
to
a / b > c

Mathematically equivalent for positive b... but not so equivalent in floating point.

But you will all be happier when your in-inventory objects don't magically fall through the back of your inventory grid in certain locations.
yay inventory progress  :D