Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Int(1.2 * 10) returns 11!

3 views
Skip to first unread message

Bernhard Just

unread,
Feb 9, 1999, 3:00:00 AM2/9/99
to
Hi, I have a little problem in XL97

Sub bla()
Dim a As Double
a = 1.2 * 10
Debug.Print Int(a)
End Sub

this returns 12 and thats right


Sub bli()
Debug.Print Int(1.2 * 10)
End Sub

this returns 11! Why?

It's the same in Access VBA and Word VBA.

Thank you for any information!

Bernha...@mch10.sbs.de

Denny Campbell

unread,
Feb 9, 1999, 3:00:00 AM2/9/99
to
Bernhard,

I confirmed the problem Under XL 97 SR-1. Since 1.2 * 10 is "a Double or
any valid numeric expression" (copied from Help), this appears to be a bug.
FWIW: Int(CDbl(1.2 * 10)) does return 12.

Denny Campbell
Grand Rapids, MI USA

Bernhard Just wrote in message <79pdhk$3tg$1...@mosquito.HL.Siemens.DE>...

Bernhard Just

unread,
Feb 10, 1999, 3:00:00 AM2/10/99
to
Hi Denny,
i tested your workaround in my XL97-SR2. It works. Thank you!
While i searched for a solution i found another curious thing:
Sub nine2ten()
For n = 9 To 10 Step 0.1
Debug.Print n
Next n
End Sub
returns
9
9,1
9,2
9,3
9,4
9,5
9,6
9,7
9,8
9,9
10
of course, you think. But...

Sub eight2ten()
For n = 8 To 10 Step 0.1
Debug.Print n
Next n
End Sub
returns
8
8,1
8,2
8,3
8,4
8,5
8,6
8,7
8,8
8,9
9
9,1
9,2
9,3
9,4
9,49999999999999
9,59999999999999
9,69999999999999
9,79999999999999
9,89999999999999
9,99999999999999

Isn't it funny?

Bernhard


Denny Campbell schrieb in Nachricht

0 new messages