[Haskell-cafe] C's fmod in Haskell
Thomas Conway
drtomc at gmail.com
Mon Sep 24 18:55:58 EDT 2007
On 9/24/07, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> Unfortunately, properFraction doesn't work well with negative numbers.
This old chestnut! It's a common problem in practice. As I recall, the
behaviour of C's % operator allows implementations to yield either
behaviour. I just checked ISO 9899:1999 which defines fmod. It
specifies that the result of fmod(x,y) should have the same sign as x.
Interesting.
cheers,
T.
--
Thomas Conway
drtomc at gmail.com
Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
More information about the Haskell-Cafe
mailing list