Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Request code
Message
 
 
To
15/09/2008 09:17:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2008 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01347514
Message ID:
01348100
Views:
15
It's not that simple. The result should be 1.7 but it's 1.8
	? 1.701, RoundUp(1.701, 1)
>I had something like this in my mind - same parameters as Round()
>
>	? 8160, RoundUp(8160, -1)
>	? 8161, RoundUp(8161, -1)
>	
>	? -8160, RoundUp(-8160, -1)
>	? -8161, RoundUp(-8161, -1)
>	
>	? 1.4, RoundUp(1.4, 1)
>	? 1.4, RoundUp(1.4, 0)
>	? 1.4, RoundUp(1.4, -1)
>	
>	
>	? 1.7, RoundUp(1.7, 2)
>	? 1.7, RoundUp(1.7, 1)
>	? 1.7, RoundUp(1.7, 0)
>	? 1.7, RoundUp(1.7, -1)
>	? 1.7, RoundUp(1.7, -2)
>	
>	? 1.711, RoundUp(1.711, 2)
>	
>	? 1.71, RoundUp(1.71, 2)
>	? 1.71, RoundUp(1.71, 1)
>	? 1.71, RoundUp(1.71, 0)
>	? 1.71, RoundUp(1.71, -1)
>	? 1.71, RoundUp(1.71, -2)
>
>function RoundUp(n, ndecimal)
>
>	return round(m.n + sign(m.n) * iif(empty(mod(m.n, 10^(-m.ndecimal))), 0, 10^(-m.ndecimal)/2), m.ndecimal)
>	
>endfunc
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform