Gustav Brock
Gustav at cactus.dk
Fri Feb 2 09:26:17 CST 2007
Hi John
Stuart is right, you should have negative numbers in mind as well.
However, what is more important is, that you cannot subtract a Double from an Integer reliably, indeed not to retrieve the digits.
Thus, CDec must be used:
dblNum = 23.01456
lngInt = Fix(dblNum)
dblDec = CDec(dblNum) - lngInt
Wrap in Abs() if you wish to strip signs.
/gustav
>>> Gustav at cactus.dk 02-02-2007 15:57:17 >>>
Hi John
Use Int() as here:
' Retrieve date (integer) part.
dblDate = Int(datTime)
' Retrieve time (decimal) part.
dblTime = datTime - dblDate
' Assemble date and time part.
datTime = CVDate(dblDate + dblTime)
/gustav
>>> jwcolby at colbyconsulting.com 02-02-2007 15:37:05 >>>
How do I get the integer part and the decimal part of a floating point
number
23.456
how do I get the 23
how do I get the .456
Using clng for example "rounds" the number up or down which isn't what I
want for the integer portion
John W. Colby
Colby Consulting
www.ColbyConsulting.com