For reference, these do work:
value 87242 int
dec 4844 int
digits 10000 int
full 87242.4844 float
(dec / (float)digits) 0.4844 float

value 105682 int
dec 961 int
digits 1000 int
full 105682.961 float
(dec / (float)digits) 0.961 float
value 78429 int
dec 5547 int
digits 10000 int
full 78429.5547 float
(dec / (float)digits) 0.5547 float
value 101236 int
dec 367 int
digits 1000 int
full 101236.367 float
(dec / (float)digits) 0.367 float

these don’t work:
value 98507 int
dec 7266 int
digits 10000 int
full 98507.73 float
(dec / (float)digits) 0.7266 float

value 54583 int
dec 5195 int
digits 10000 int
full 54583.52 float
(dec / (float)digits) 0.5195 float
value 89508 int
dec 4688 int
digits 10000 int
full 89508.47 float
(dec / (float)digits) 0.4688 float
value 87882 int
dec 6094 int
digits 10000 int
full 87882.61 float
(dec / (float)digits) 0.6094 float

Sorry for calling you batshit crazy Chris, i really do believe there is an issue here now.

Btw, i’ve got a string to double converter for the GPS class that is wayyyy faster than the builtin one. My original attempt at going faster than the builtin was 681ms for 200 conversions vs 534ms for the builtin. I’m now at 386.9ms for 200 ops, without compiler optimisations. Compiler optimisations take my code to 313.96ms, double.Parse to 528.28ms. \o/ My version is more than a 1 milisecond faster per conversion.

I found a FastNumberParse class in some netmf uav controller, it came up at over 700ms for the same 200 operations hehe.

It’s really amazing seeing how huge some really basic things can improve performance in NetMF.

I had a ton of issues with my PID controller until I dissected it and found out that the floats were all messed up., changing everything to double fixed the issue, at least till I optimize the code.

I think some people need to understand floating point numbers and how they are implemented.

Ie … if you need total precision you need a 64 bit (double) as there are only a finite decimal places depending on the number ie with 24 bit IEEE float if you number is bigger than 1000 you do not have as much decimal precision as when your number is less than 10.

if you have a 16 bit mantissa and 10 bits make up the actual number there are only 6 bits left for decimal precision. (sounds a lot, but it isnt ) 6 bits will barely give you 2/3 decimal places. where as 12 bits will give you at least 6 / 7 decmal places (obviously depending on the number… recurring numbers are the worst ) 0.5, 0.75, 0.25 and muliples of are the best.

I’m pretty sure a single is 32 bits 1 sign 8 exponent and 23 mantissa.
with the number 103456 you need 17 bits for the number alone leaving 6 for the precision

Singles are good for small numbers but doubles are needed for large numbers and a decent precision…