
On Wed, 12 Mar 2008, Don Stewart wrote:
I am under the restriction that I need to write Haskell programs using Double which mimic existing C/C++ programs or generated data sets, and get the same answers. (It's silly, but take it as a given requirement.) If the C programs are using "log2", then I need "log2" in the Haskell, or else I run the risk of not producing the same answers.
Hey Jacob,
Just to make life super simple, I packaged up a binding to the basic math.h library for Doubles. You can find the library here:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cmath
For example,
Prelude> Foreign.C.Math.Double.log10 5 0.6989700043360189
Prelude> log 5 / log 10 0.6989700043360187
You may want to write a RULES pragma which replaces occurences of 'logBase 2' and 'logBase 10' by their specialised counterparts.