double d = double.Parse("-0.1");gives us d = 0.1
I assume this is probably a .NETMF bug rather than Netduino specific, but it seems odd that this would have slipped through the net.
  | ||||||||||||||
double.Parse bug
Started by Fred, Mar 29 2011 10:02 PM
3 replies to this topic
#1Posted 29 March 2011 - 10:02 PM
I think I may have stumbled across quite a surprising bug. It seems that double.Parse ignores the sign of numbers between 0 and -1.
double d = double.Parse("-0.1");gives us d = 0.1 I assume this is probably a .NETMF bug rather than Netduino specific, but it seems odd that this would have slipped through the net. #2Posted 30 March 2011 - 12:15 AM
Confirmed. I see the same behaviour in NETMF but not in the full framework.
-0.1 to -0.9 are parsed as positive values.
#3Posted 30 March 2011 - 06:44 PM
Hi Fred,
I've verified that this is an issue which also exists in the .NET MF emulator, and have reported the bug to Microsoft.
http://netmf.codeplex.com/workitem/788
Thank you for reporting this,
Chris
#4Posted 30 March 2011 - 09:15 PM
Thanks. It causes a real problem with GPS calculations when you live just a little bit west of the Greenwich Meridian!
0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | ||||||||||||||
|
||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ||||||||||||||