 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ggirf14
Joined: 01 Nov 2005 Posts: 96 Location: Ottawa
|
Posted: Fri Jun 15, 2007 12:43 am Post subject: Does "Round(Number [, N])" accept a variable for & |
|
|
My plan is :
Var1 = 17.00
4000.00 / Var1 = %x%
Round(%x% [, 2])
MsgBox, %x%
I am expecting in the result 200
for the following logic:
4000 / 17.00 = 235.29411764705882352941176470588 ; This is %x%
Round(%x% [, 2]) ; should round this up to 200???
Where do I go wrong | Code: | Var1 = 17.00
Var2=4000
EnvDiv, Var2, Var1 ;,Round(%Var2% ,1)
Round(%Var2% ,1)
MsgBox, %Var2%
|
|
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Fri Jun 15, 2007 1:01 am Post subject: |
|
|
| AHK Help wrote: | Round(Number [, N]): If N is omitted or 0, Number is rounded to the nearest integer. If N is positive number, Number is rounded to N decimal places. If N is negative, Number is rounded by N digits to the left of the decimal point. For example, Round(345, -1) is 350 and Round (345, -2) is 300. Unlike Transform Round, the result has no .000 suffix whenever N is omitted or less than 1. In v1.0.44.01+, a value of N greater than zero displays exactly N decimal places rather than obeying SetFormat. To avoid this, perform another math operation on Round()'s return value; for example: Round(3.333, 1)+0.
|
| Code: | | MsgBox, % Round(4000/17,-2) |
|
|
| Back to top |
|
 |
ggirf14
Joined: 01 Nov 2005 Posts: 96 Location: Ottawa
|
Posted: Fri Jun 15, 2007 1:12 am Post subject: |
|
|
Thank You!  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|