[Haskell-cafe] C's fmod in Haskell

ok ok at cs.otago.ac.nz
Mon Sep 24 23:04:28 EDT 2007

On 25 Sep 2007, at 10:55 am, Thomas Conway wrote:
> 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.

Interesting, perhaps.  Surprising, no.  fmod() is basically there for
the sake of sin(), cos(), and tan() (or any other periodic and
either symmetric or antisymmetric function).

More information about the Haskell-Cafe mailing list