Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: plcnut on May 08, 2015, 12:43:48 PM
-
I am trying to use a FmtReal(R2,1,0,dec) inside a STRPRINT.
The value in R2 is "2000", the value printed is "2000.000000"
Am I doing something wrong?
(https://forum.hosteng.com/proxy.php?request=http%3A%2F%2Fi761.photobucket.com%2Falbums%2Fxx256%2Fplcnut%2FDMDReals_zpseibeizkp.png&hash=4ab6a8c4d141cb6acea3b7d01f1cef8e2662de1f) (http://s761.photobucket.com/user/plcnut/media/DMDReals_zpseibeizkp.png.html)
-
Appears to be a bug - not sure why. It should do what you are expecting.
-
OK.
Thanks!
-
Apparently 0 precision translates into something like max precision. I'll look into it. Might not have any choice but to convert to int.
-
Zero is being treated as no precision specified, i.e., as printf("%f") instead of printf("%*.0f"). Given that ".0" serves a useful purpose for printf, I guess I should change it, although it makes me slightly nervous to do so.
-
I was only going by the manual (I actually read it :) )
(https://forum.hosteng.com/proxy.php?request=http%3A%2F%2Fi761.photobucket.com%2Falbums%2Fxx256%2Fplcnut%2FDMDReals02_zpsnfdjmzuk.png&hash=6cd083851605ddf4ddc7e755ba8b772895e45ba5) (http://s761.photobucket.com/user/plcnut/media/DMDReals02_zpsnfdjmzuk.png.html)
-
I was only going by the manual (I actually read it :) )
'0' is valid...it just meant don't use the precision specifier.
I have now changed it...and instructed DocuMan to reflect accordingly...to using 255 as the 'don't use precision value'. Zero will do what it was actually intended to do. Sorry for the oops, and thanks for the heads up.
-
After reading this thread, I had to try it out in the simulator. Yep it's the same. So I also tried 255 for the precision in FmtReal per help file, well any value over 102 caused simulator to crash.
I just want to let you know in-case it could be a problem in the do-more itself.
-
I also tried 255 for the precision in FmtReal per help file, well any value over 102 caused simulator to crash.
If I place 255 in an actual CPU, I get the result that I expected to get from a 0 (Zero); there were no zeroes after the decimal...
-
All of the internal token buffers were 100 bytes, which under normal circumstances is about 90 bytes longer than needed. With 255 characters following the decimal, she go boom.
I've fixed both issues.