Source language: Translate to:

rounding off?

General questions about NeoBook

Moderator: Neosoft Support

rounding off?

Postby yanzco » Sat Feb 11, 2017 12:28 am

hello guys, how do you round off a number?

from 2 decimal points... 22.75 = rounds off to 23 ...
yanzco
 
Posts: 175
Joined: Sun Jul 20, 2014 4:07 am

Re: rounding off?

Postby mishem » Sat Feb 11, 2017 1:02 am

Math "Round (22.75)" "-1" "[result]"
[result]=23

Math "Trunc (22.75)" "-1" "[result]"
[result]=22
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: rounding off?

Postby yanzco » Sat Feb 11, 2017 2:13 am

thanks :)
yanzco
 
Posts: 175
Joined: Sun Jul 20, 2014 4:07 am

Re: rounding off?

Postby Gaev » Sat Feb 11, 2017 7:32 am

yanzco:

Also ...
Code: Select all
Math "[yourNumber]" "0" "[roundedResult]"
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: rounding off?

Postby yanzco » Sat Feb 11, 2017 9:21 pm

i tried that Gaev..
but somehow, the total result.. sometimes go 101... supposed to be 100..
but when i use the round value before the calculations, total is 100..

not sure why, but maybe rounding before the calculations..
but nevertheless.. its just 1.. :D its fine..
yanzco
 
Posts: 175
Joined: Sun Jul 20, 2014 4:07 am

Re: rounding off?

Postby Gaev » Sun Feb 12, 2017 6:21 am

yanzco:

but somehow, the total result.. sometimes go 101... supposed to be 100..

I tried the following tests that all produced results as expected ...

[yourNumber] ==> [roundedResult]
100.1 ==> 100
100.49 ==> 100
100.5 ==> 101
100.67 ==> 101

Please post the input values you used that resulted in incorrect answers.

Also, post the exact Math command you are using.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: rounding off?

Postby yanzco » Sun Feb 12, 2017 9:03 am

i see, it seems to work properly now, i think it was the math computation that i used before..
it was some percentage calculation, then some additions, then some more additions..

but all is fine now.. :)
yanzco
 
Posts: 175
Joined: Sun Jul 20, 2014 4:07 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: No registered users and 3 guests