View Full Version : cInt question
Clayton
20-Aug-2010, 01:24 PM
Hi.
I have a situation where I need convert an expression to integer without rounding, in this
let iEmbalagens = cint(gnPecas/{SCV030.QTDADE})
The instructions at user's guide says that CInt function always rounds the expression, is there other function to get a integer without rounding?
Thanks.
Focus
20-Aug-2010, 02:15 PM
That looks like a bit of VB code ?
VDF Integer function does not round. ie both these result in 3 in i
Procedure Test
Integer i
Move (Integer(3.7)) to i
Move (Integer(3.2)) to i
End_Procedure
HTH
Garret Mott
20-Aug-2010, 02:18 PM
That looks like a bit of VB code ?
VDF Integer function does not round. ie both these result in 3 in i
Procedure Test
Integer i
Move (Integer(3.7)) to i
Move (Integer(3.2)) to i
End_Procedure
HTH
I've been bitten the same way. This is in the VRW forum, & VRW does indeed use VB-like code.
;-)
Focus
20-Aug-2010, 02:33 PM
No one expects the spanish inquisition :D
You could convert to a string, chop it and move it back. Seems crude though. probably a better way
Clayton
20-Aug-2010, 02:35 PM
I know... :D That's exactly what I'm looking for, but the VRW language hasn't same behaviour that VDF language.
If there is no function I'll do the calculations "manually".
Garret Mott
20-Aug-2010, 02:38 PM
No one expects the spanish inquisition :D
Darn - & I was just getting the rack & thumbscrews oiled up & ready to go!
Ulbe Stellema
20-Aug-2010, 04:03 PM
Fix() fixes the problem... :rolleyes:
Check out the Fix() function, which returns only the integer part without rounding.
Clayton
20-Aug-2010, 06:21 PM
Thank you.
Bob Worsley
20-Aug-2010, 09:45 PM
Fix() fixes the problem... :rolleyes:
Check out the Fix() function, which returns only the integer part without rounding.
That name's intuitive... :D
Larry R Pint
23-Aug-2010, 09:10 AM
That name's intuitive... :D
If you have a problem ... it fixes it!:p
In which case I better add fix() to every line of code I write!:eek:
Bob Worsley
23-Aug-2010, 10:34 AM
If you have a problem ... it fixes it!:p
In which case I better add fix() to every line of code I write!:eek:
Yeah, now that I think about it, I can use that function in quite a few places myself.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.