cvs commit: fptools/libraries/base/GHC Float.lhs Real.lhs fptools/libraries/base/Text/Read Lex.hs

Simon Marlow simonmar@microsoft.com
Tue, 18 Jun 2002 10:49:29 +0100


> simonpj     2002/06/18 02:31:06 PDT
>=20
>   Modified files:
>     libraries/base/GHC   Float.lhs Real.lhs=20
>     libraries/base/Text/Read Lex.hs=20
>   Log:
>   	--------------------------
>   	Deal with NaN and Infinity
>   	--------------------------
>  =20
>   This commit arranges that
>  =20
>   * GHC.Real exports	infinity   :: Rational =3D 1 :% 0
>   			notANumber :: Rational =3D 0 :% 0
>  =20
>   * GHC.Float.fromRat converts these Rational non-numbers into
>     their Float/Double equivalents
>  =20
>   As a result, arith015/arith016 start to work again.  We can
>   read NaN and Infinity into Float/Double.

This reminds me of a point from my whiteboard:

  what should 'decodeFloat (read "NaN" :: Float)' do?

presumably an exception should be raised.  Currently we return some junk
values (related to the actual representation of NaN as a Float).=20

Any thoughts?  The report isn't very enlightening.

Cheers,
	Simon