arithmetic problem in a VB module 
Author Message
 arithmetic problem in a VB module

I am a french student and for my final year project
I am using ms access 97 on a P 200 MMX
Nevertheless in a VB module the result of multiplication
with singles is not correct !
for exemple  :
dim a,b,c as single
a=15.55
b=8.98
c=a*b*0.83
And with the de{*filter*}, I can see c=123.353760070801 !??
If somebody can to explain this mistake, please send me a e-mail

Thanks

--



Thu, 09 Nov 2000 03:00:00 GMT  
 arithmetic problem in a VB module

I don't have time to check your problem, but I thought I would point out
that

dim a,b,c as single

does not declare a, b and c as single.
In your example, a and b are variants. Use:

dim a as single, b as single, c as single

Regards,
David Hager

Quote:

>I am a french student and for my final year project
>I am using ms access 97 on a P 200 MMX
>Nevertheless in a VB module the result of multiplication
>with singles is not correct !
>for exemple  :
>dim a,b,c as single
>a=15.55
>b=8.98
>c=a*b*0.83
>And with the de{*filter*}, I can see c=123.353760070801 !??
>If somebody can to explain this mistake, please send me a e-mail

>Thanks

>--




Thu, 09 Nov 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. arithmetic problem

2. any sample code of Arithmetic Coding in VB?

3. Can VB do binary arithmetic?

4. Unsigned arithmetic in VB

5. How can I use VB for binary arithmetic

6. VB Modules/Class Modules

7. VB Script Problem in access 97 / Module

8. Log info with SS and VB in Form and Class modules problem

9. Modules, Modules, Modules

10. Simple arithmetic with DOCVARIABLES

11. Error handling / Arithmetic overflow error

12. Arithmetic operation resulted in an Overflow in FilePut

 

 
Powered by phpBB® Forum Software