Odd side effect of using chr

Gavin Lowe <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
Hi

I think this is a hugs bug.

If I calculate

  Prelude> let g n =  n^25 `mod` 18721  in g 4

I get

  17173

But then if I calculate

  Prelude> let f n = snd( chr n, n^25 `mod` 18721 ) in f 4

I get

  0

Which is different!  I think the former is correct, FWIW.  Replacing the
"chr n" by something not involving chr and n gives 17173.

This is with Hugs Version December 2001, running on a SunBlade 100 with
Solaris 9.

Gavin

--
Gavin Lowe

Oxford University Computing Laboratory, Parks Road, Oxford, OX1 3QD.
Phone: +44 1865 273841.  Fax: +44 1865 273839.
E-mail: [email protected]

The secret of all discoverers is that they regard nothing as impossible
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.