View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default Strange Log base 10 results

Harlan Grove wrote...
....
So what to do? Add a bias value and round the result.

Const BIAS As Double = 5E-16
':
y = Log(x) / Log(10) + Sgn(Log(x)) * BIAS

....

I was being too nasty. While VBA shouldn't fail like this for x = 10,
all the other languages I tried failed for some x = 10^n, integer n
1. This is just something that suffers a lot from floating point
rounding error. Adding a bias value is about all you can do.