On Wed, Mar 12, 2008 at 9:27 PM, Don Stewart [EMAIL PROTECTED] wrote:
You could consider binding directly to the C functions, if needed,
{-# OPTIONS -fffi -#include math.h #-}
import Foreign.C.Types
foreign import ccall unsafe math.h log10
c_log10 :: CDouble - CDouble
Hello David,
Monday, March 17, 2008, 7:59:09 PM, you wrote:
foreign import ccall unsafe math.h log10
c_log10 :: CDouble - CDouble
log10 :: Double - Double
log10 x = realToFrac (c_log10 (realToFrac x))
It's a bit sloppier, but shouldn't cause any trouble. And I've no
On 17 Mar 2008, [EMAIL PROTECTED] wrote:
Hello David,
Monday, March 17, 2008, 7:59:09 PM, you wrote:
foreign import ccall unsafe math.h log10
c_log10 :: CDouble - CDouble
log10 :: Double - Double
log10 x = realToFrac (c_log10 (realToFrac x))
It's a bit sloppier, but shouldn't cause any
daveroundy:
On Wed, Mar 12, 2008 at 9:27 PM, Don Stewart [EMAIL PROTECTED] wrote:
You could consider binding directly to the C functions, if needed,
{-# OPTIONS -fffi -#include math.h #-}
import Foreign.C.Types
foreign import ccall unsafe math.h log10
c_log10
On Mon, Mar 17, 2008 at 12:59:09PM -0400, David Roundy wrote:
foreign import ccall unsafe math.h log10 log10 :: Double - Double
since in ghc CDouble and Double are identical.
It's a bit sloppier, but shouldn't cause any trouble. And I've no
idea how realToFrac is implemented, but would
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
Jacob Schwartz [EMAIL PROTECTED] writes:
A test on IEEE computers (x86 and x86-64), shows that for
a range of 64-bit double values, the answers in C do differ (in the
last bit) if you use log2(x) and log10(x) versus log (x) /
log(2) and log(x) / log(10).
I think this may also depend on C
Wow, you have a tough mission if you want to replicate the bit level answers
for double (btw, hi Jacob).
Libraries differ for transcendental function, and even worse, CPUs differ.
You may get different answers on an Intel and and AMD.
That said, I think your best bet is to import log2 and log10
On Mar 12, 2008, at 8:35 PM, Jacob Schwartz wrote:
My second question is how to get at the IEEE bit representation for a
Double.
My (rhetorical) question on this front isn't how do I get the
representation, but why is it so hard and non-portable to get the
representation sensibly? A
On Thu, 13 Mar 2008, Lennart Augustsson wrote:
Wow, you have a tough mission if you want to replicate the bit level answers
for double (btw, hi Jacob).
Libraries differ for transcendental function, and even worse, CPUs differ.
You may get different answers on an Intel and and AMD.
That
On Thu, Mar 13, 2008 at 1:35 AM, Jacob Schwartz [EMAIL PROTECTED] wrote:
I have two questions about using the Double data type and the
operations in the Floating typeclass on a computer that uses IEEE
floating point numbers.
I notice that the Floating class only provides log (presumably
On Mar 13, 2008, at 5:12 , Ketil Malde wrote:
Perhaps now everybody uses SSE to do math, but earlier Intel FPU
architectures did floating point with 80-bit registers, so the
accuracy of the result could depend on whether an intermediate result
was flushed to memory (by a context switch).
I have two questions about using the Double data type and the
operations in the Floating typeclass on a computer that uses IEEE
floating point numbers.
I notice that the Floating class only provides log (presumably log
base 'e') and logBase (which, in the latest source that I see for
GHC is
quark:
I have two questions about using the Double data type and the
operations in the Floating typeclass on a computer that uses IEEE
floating point numbers.
I notice that the Floating class only provides log (presumably log
base 'e') and logBase (which, in the latest source that I see for
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
15 matches
Mail list logo