Page 2 of 2

Re: Approximate numbers Help

Posted: Thu Mar 24, 2016 11:21 am
by nix
hmm, maybe some multiplication and division trick using int?

But Ruby is prolly the way

Re: Approximate numbers Help

Posted: Thu Mar 24, 2016 11:23 am
by Nowhk
nix wrote:But Ruby is prolly the way

Yes :) Maybe in the future there will be a dedicated prim ;) Thanks for the hints anyway!

Re: Approximate numbers Help

Posted: Thu Mar 24, 2016 12:51 pm
by Nubeat7
Nowhk wrote:Anyway, that's won't "round" really to the last digit, just "cut" the string.


thats not true, the format string does correct rounding...

this has been discussed several times here on the forum, here is one with different solutions:
viewtopic.php?f=3&t=3666&start=30

Re: Approximate numbers Help

Posted: Thu Mar 24, 2016 2:17 pm
by Nowhk
Nubeat7 wrote:
Nowhk wrote:Anyway, that's won't "round" really to the last digit, just "cut" the string.


thats not true, the format string does correct rounding...

this has been discussed several times here on the forum, here is one with different solutions:
viewtopic.php?f=3&t=3666&start=30

Oh nice, your example seems to works better. In fact here the rounding is not the expected value:

format_2.fsm
(506 Bytes) Downloaded 854 times

(for you example, 57.783 and not 57.784). Thanks for the tip dude! Another learned thing!