From: Masahiro Tanaka Date: 2000-09-29T02:05:16+09:00 Subject: [ruby-talk:5177] Re: Proposal: Add constants to Math Hi, >From: Masahiro Tanaka >Subject: [ruby-talk:5138] Re: Proposal: Add constants to Math > IMHO, A practical way is, to check IEEE 754 support at the > configure time, and then define Float::NAN with 0.0/0.0 or > the bit pattern of NaN. My idea was to insert such a script like below in configure.in, and surround the definition of Float::NaN/Inf with #ifdef HAVE_IEEE_NAN_INF ... #endif Because some machine raises exception when calculating 0.0/0.0, and then the program terminates. Regards, Masa Tanaka --- configure.in --- AC_CACHE_CHECK(whether IEEE754 NaN/Inf support, rb_cv_ieee_nan_inf, [AC_TRY_RUN([ int main() { double zero=0.0, one=1.0, nan, inf; nan = zero/zero; inf = one/zero; if (nan!=nan && inf==inf+1) return 0; return 1; } ], rb_cv_ieee_nan_inf=yes, rb_cv_ieee_nan_inf=no, rb_cv_ieee_nan_inf=no)]) if test "$rb_cv_ieee_nan_inf" = yes; then AC_DEFINE(HAVE_IEEE_NAN_INF) fi ---