It shoudl be 0 but it is 1.4210854715202E-14

  • Thread starter Thread starter M Skabialka
  • Start date Start date
M

M Skabialka

I have a query where hours assigned and a sum of hours used is calculated
for a report. Another field in the query subtracts used from assigned but
sometimes I get strange results:

HoursAssigned SumOfHoursWorked HoursRemaining
5.5 1.25 4.25
6 1.25 4.75
125.2 125.2 1.4210854715202E-14
198.5 146 52.5
198.5 122 76.5
10 5 5
129 129 0

Why would I get 1.4210854715202E-14 when it should be 0?

I prefer not to force a format, to make the report simpler to read, so we
see 5, not 5.00.

Thanks,
Mich
 
I have solved the problem another way; in my report I use:

=IIf(Abs([HoursRemaining])<0.001 And [HoursRemaining]>0,0,[HoursRemaining])

Mich
 
That's just how floating point numbers work on computers. Just as you and I
can't represent 2/3 exactly, there are many fractional values that computers
can only approximate.

The workaround you show in your other post is typical.
 
Douglas J. Steele said:
That's just how floating point numbers work on computers. Just as you and I
can't represent 2/3 exactly

Don't be silly. Send me $3,000,000.00 and I will send exactly 2/3 of it back
to you;)
Who needs to turn $6.00 into $6,000.00?
 
Back
Top