addition of 0.7 and 0.1 is not 0.8 CDbl / CStr vbs problem
- From: robin@xxxxxxxxx
- Date: Thu, 21 Jun 2007 07:41:05 -0700
Hello Group,
i have some vbs code here and would be happy if one of you could
describe whats wrong with it.
i just would like to make addition of 0.1 and 0.7 but the result just
surprises me everytime again.
btw. i work on a system with german number format.
IF ((CDbl("0,7")+CDbl("0,1"))=(CDbl("0,8"))) THEN
MSGBOX "0,7 + 0,1 = 0,8"
ELSE
MSGBOX "0,7 + 0,1 IS NOT 0,8"
END IF
the solution for this problem is:
IF (CDbl(CStr(CDbl("0,7")+CDbl("0,1")))=(CDbl("0,8"))) THEN
MSGBOX "0,7 + 0,1 = 0,8"
ELSE
MSGBOX "0,7 + 0,1 IS NOT 0,8"
END IF
but what to hell is going on ???
kindest regards,
Robin
btw. the same prob occures with 10,7 + 0,1
.
- Follow-Ups:
- Re: addition of 0.7 and 0.1 is not 0.8 CDbl / CStr vbs problem
- From: Anthony Jones
- Re: addition of 0.7 and 0.1 is not 0.8 CDbl / CStr vbs problem
- Prev by Date: Re: cany someone explain how this Rnd() statement works?
- Next by Date: Create users in AD from SQL db, and setting passwords of theirs
- Previous by thread: cany someone explain how this Rnd() statement works?
- Next by thread: Re: addition of 0.7 and 0.1 is not 0.8 CDbl / CStr vbs problem
- Index(es):
Relevant Pages
|