Thread: Function Int
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Function Int

http://tinyurl.com/y4g5qg

or

http://tinyurl.com/wkmvr

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"bcar" wrote in message
...
John Bundy a écrit :
Take out the Int stuff and it should be fine:

Sub test()
Dim x As Long

x = 37.7266 * 10000
' x = 377265
' I hope x = 377266

' but for :
x = 37.7263 * 10000
' I have x = 377263


no because it's an expression and it's possible to have more than 4
decimals numbers.
the complete expression is :
x = y * 10000 - Int(y * 10000)
I know it's posssible to do x = y - round(y, 4) or to do :
tmp = y * 10000
x = tmp - Int(tmp)
The 2 solution work fine, but I don't want a solution, I'm surprised by
the result and I search an explanation

Thanks