Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Absolute value of a value
Message
From
10/11/2011 16:30:05
 
 
To
10/11/2011 16:14:57
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01528610
Message ID:
01528618
Views:
61
>>Math.Abs(value)
>
>I tried that but that is not the same as the VFP CInt() function. Math.Abs(0.39) would return the same value. There must be something I am missing here. I am looking for the 0 value here. As, everything between 0 to 0.99, I would like to obtain 0. So, would be from all values between 1 to 1.99 would return 1.

You don't want Abs( ), you want the .Net equivalent of the VFP FLOOR( ) function.

Although, for your purposes Int( ) should work. They do differ for negative numbers e.g.

INT( 1.99 ) = 1
FLOOR( 1.99 ) = 1

INT( -1.99 ) = -1
FLOOR( -1.99 ) = -2

FLOOR( -2.01 ) = -3
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform