AOB
Well-known Member
- Joined
- Dec 15, 2010
- Messages
- 669
- Office Version
- 365
- 2016
- 2013
- Platform
- Windows
Hi there,
Having a strange (i.e. unexpected) error when attempting to divide 1 by a large number (specifically : 345,600)
( 1/(60*60*24*4) represents a quarter of a second as a fraction of one day...)
The answer should be ~2.893519x10^-6
It results in an overflow but I'm using the Double variable type which I would have thought could handle this?
From Excel Help :
Any ideas as to why this would be causing an overflow, and thus how I can get around it?
Thanks!
AOB
Having a strange (i.e. unexpected) error when attempting to divide 1 by a large number (specifically : 345,600)
( 1/(60*60*24*4) represents a quarter of a second as a fraction of one day...)
The answer should be ~2.893519x10^-6
It results in an overflow but I'm using the Double variable type which I would have thought could handle this?
Code:
Dim x As Double
x = 1 / (60 * 60 * 24 * 4)
From Excel Help :
Double (double-precision floating-point)
variables are stored as IEEE 64-bit (8-byte) floating-point numbers ranging
in value from -1.79769313486231E308 to -4.94065645841247E-324 for negative
values and from 4.94065645841247E-324 to 1.79769313486232E308 for positive
values. The type-declaration character for Double is the number sign (#).
Any ideas as to why this would be causing an overflow, and thus how I can get around it?
Thanks!
AOB
Last edited: