Approximate numbers Help

For general discussion related FlowStone
Wassaka
Posts: 85
Joined: Wed Dec 30, 2015 3:41 am

Approximate numbers Help

Post 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 :roll: :|
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Approximate numbers Help

Post by RJHollins »

use the ROUND primitive. You can set the number of decimal places.
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Approximate numbers Help

Post 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 :shock:
I always do this passing the value via Ruby :?
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Approximate numbers Help

Post by RJHollins »

no ... its been there forever.

check/search toolbox for things like 'formatting'.

tomorrow I'll look up what I have.
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Approximate numbers Help

Post 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.
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Approximate numbers Help

Post by nix »

Here is stream and green->
integers.fsm
(606 Bytes) Downloaded 879 times
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Approximate numbers Help

Post 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.
Last edited by Nowhk on Thu Mar 24, 2016 10:55 am, edited 1 time in total.
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Approximate numbers Help

Post by nix »

integers.png
integers.png (18.08 KiB) Viewed 18915 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
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Approximate numbers Help

Post by nix »

format.fsm
(381 Bytes) Downloaded 947 times


Formatting command was found by Trogluddite,
hope helps, but maybe not what you want
Nowhk
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Approximate numbers Help

Post 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.
Post Reply