I have the following calculation
VB Code:
BigNumber = 10000000000000 SmallNumber = 943 MsgBox BigNumber \ SmallNumber
When using any of the Data Types I always get Error 6 "Overflow" returned, is there any way around this?
Thanks in Advance,
Matt
Printable View
I have the following calculation
VB Code:
BigNumber = 10000000000000 SmallNumber = 943 MsgBox BigNumber \ SmallNumber
When using any of the Data Types I always get Error 6 "Overflow" returned, is there any way around this?
Thanks in Advance,
Matt
Long should work
Actually a long wouldnt work... You'll need to use a Single or Double (Single should be fine).
From Online Help...
A long integer between – 2,147,483,648 and 2,147,483,647.
A single-precision floating-point value with a range of – 3.402823E38 to – 1.401298E-45 for negative values, 1.401298E-45 to 3.402823E38 for positive values, and 0.
A double-precision floating-point value with a range of – 1.79769313486232E308 to – 4.94065645841247E-324 for negative values, 4.94065645841247E-324 to 1.79769313486232E308 for positive values, and 0
well, I was wrong
Im stumped ... Decimal doesnt even work
doh! I missed somehting ... use /
\ is int division
VB Code:
Dim bignumber Dim smallnumber bignumber = CDec(10000000000000#) smallnumber = CDec(943) bignumber = CDec(bignumber) smallnumber = CDec(smallnumber) MsgBox bignumber / smallnumber
that works for sure!
I really need to do this :
VB Code:
bignumber = CDec(10000000000000#) smallnumber = CDec(943) bignumber mod smallnumber
It is part of an algorithm and as I said all I get is Error 6 Overflow
Cheers
Using the "Mod" Function and this number "1000000000#" works but when I use the slightly longer number of "100000000000000" it doesn't and that is when I get returned that nasty Overflow Message.
Cheers
remember this
the number can not by endless