Hi everyone!
In the tease I'm making at the moment I have a user defined point value being multiplied by a random factor of 0.1, 0.2, 0.3 etc. up to 1.9.
It works totally fine for multiples of 10, but otherwise it can result in non-whole numbers, especially when done more than once as is the intention (after a few tries it can result in over 10 decimal places).
Is there a way to round up (or down) this value to the nearest whole number?
If that's not possible, can I make a user input accept only multiples of 10?
Hope you guys can help!
Decimal points to whole numbers in Eos
-
intermolecularpyro
- Explorer

- Posts: 51
- Joined: Wed Jan 15, 2020 8:19 am
Re: Decimal points to whole numbers in Eos
Code: Select all
Math.floor(1.99) // will return 1
Math.ceil(1.2) // will return 2
Math.round(1.2) // will return 1
Math.round(1.99) // will return 2
https://www.educative.io/edpresso/mathc ... javascript
-
intermolecularpyro
- Explorer

- Posts: 51
- Joined: Wed Jan 15, 2020 8:19 am
Re: Decimal points to whole numbers in Eos
This works perfectly, thank you!

