[chuck-users] Feature request

Ge Wang gewang at CS.Princeton.EDU
Wed Feb 8 10:47:53 EST 2006


Hi Mike!

> I was wondering if it would be possible to include some method of
> determining if a function returns 'nan'?

This is a great idea.  Added and committed to CVS.

   int math.isinf( float )
   int math.isnan( float )

Also adding examples/basic/infnan.ck

   // big number
   1000000000000000000000000000.0 => float n;
   // overflow it
   repeat( 20 ) n *=> n;
   // test it
   <<< math.isinf( n ) >>>;
   // bye sanity
   0 *=> n;
   // test it
   <<< math.isnan( n ) >>>;

   // more
   <<< 1.0 / 0.0 => math.isinf >>>;
   <<< 0.0 / 0.0 => math.isnan >>>;

So far, this seems portable on osx, linux, win32.  We will see if
and how it breaks under different systems as we go.

Best,
Ge!



More information about the chuck-users mailing list