Page 1 of 2
Approximate numbers Help
Posted: Thu Mar 24, 2016 2:54 am
by Wassaka
First, Probably is a very very easy thing to do but i am very newbie... Well I am trying to approximate a decimal number to a whole number. Thanks and sorry my ignorancy

Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 3:17 am
by RJHollins
use the ROUND primitive. You can set the number of decimal places.
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 9:36 am
by Nowhk
RJHollins wrote:use the ROUND primitive. You can set the number of decimal places.
Is it somethings added on 3.0.9? I can't see any ROUND primitive in my toolbox
I always do this passing the value via Ruby

Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 10:39 am
by RJHollins
no ... its been there forever.
check/search toolbox for things like 'formatting'.
tomorrow I'll look up what I have.
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 10:42 am
by Nowhk
RJHollins wrote:no ... its been there forever.
check/search toolbox for things like 'formatting'.
tomorrow I'll look up what I have.
I know that, but it's for string.
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 10:51 am
by nix
Here is stream and green->
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 10:55 am
by Nowhk
nix wrote:Here is stream and green->
integers.fsm
Yes. But I meant: what if you have a Float prim with value 2.234523 and you want to "round" to 2 digit (i.e. 2.23)?
Such as
round in Ruby.
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 10:55 am
by nix

- integers.png (18.08 KiB) Viewed 18931 times
edit- Nowhk mate, this wasn't a reply to you, just showing it if it doesn't open in current FS.
I'm sure I know how to format, just a sec
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 11:02 am
by nix
Formatting command was found by Trogluddite,
hope helps, but maybe not what you want
Re: Approximate numbers Help
Posted: Thu Mar 24, 2016 11:09 am
by Nowhk
nix wrote:format.fsm
Formatting command was found by Trogluddite,
hope helps, but maybe not what you want
Not sure how fast is passing between float-string-float. Anyway, that's won't "round" really to the last digit, just "cut" the string.