Mythruna
April 20, 2024, 02:00:24 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Why coding is "fun"...  (Read 7680 times)
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« 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.
Logged
Iggyjeckel
Donators
Hero Member
***
Posts: 510


View Profile
« Reply #1 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.

Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #2 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. Wink

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. Smiley
Logged
Iggyjeckel
Donators
Hero Member
***
Posts: 510


View Profile
« Reply #3 on: September 16, 2013, 11:52:21 AM »

I was just commenting on some of my joys while programming.
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #4 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."  Smiley
Logged
ebag51
Donators
Hero Member
***
Posts: 531


View Profile
« Reply #5 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  Cheesy
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!