add missing finite? function

This commit is contained in:
Yuichi Nishiwaki 2013-12-10 05:40:26 -08:00
parent afe630bc42
commit 6dc66d354c
1 changed files with 15 additions and 0 deletions

View File

@ -53,6 +53,21 @@ pic_number_inexact_p(pic_state *pic)
return pic_bool_value(pic_float_p(v));
}
static pic_value
pic_number_finite_p(pic_state *pic)
{
pic_value v;
pic_get_args(pic, "o", &v);
if (pic_int_p(v))
return pic_true_value();
if (pic_float_p(v) && ! (isinf(pic_float(v)) || isnan(pic_float(v))))
return pic_true_value();
else
return pic_false_value();
}
static pic_value
pic_number_infinite_p(pic_state *pic)
{