jim_mckay
(jim mckay)
November 13, 2015, 6:23pm
1
Ran into this earlier and can’t figure out how round(0.0) returns NaN.
I have a structure, pnt{x as double, y as double}
2 lines
pnt.x=round(pnt.x)
pnt.y=round(pnt.y)
somehow I end up with {NaN,0}
I changed the code to assign to an integer as the rounding step, but I’d like to understand what might cause this… any ideas?
Ben_Joyner
(Ben Joyner)
November 13, 2015, 9:33pm
2
Perhaps try testing to see that pnt.x and pnt.y actually have values, or set them to a default value of 0.0?
jim_mckay
(jim mckay)
November 13, 2015, 11:55pm
3
They show as 0 in the debugger. I’m wondering if there’s something strange in the calculations that arrive at zero… other values have no issue. and zero only has trouble in the x calculation…