Reputation: 7272
I want to do the equivalent of
::Infinity= 1.0/0
in a ruby extension which is written in C.
So far I have come up with
rb_const_set(rb_mKernel, rb_intern("Infinity"), rb_float_new(1.0/0));
which gives me a compiler warning due to division by zero. And
rb_const_set(rb_mKernel, rb_intern("Infinity"), rb_eval_string("1.0/0"));
which is ugly due to the usage of eval
.
What is a clean proper solution to this?
Upvotes: 3
Views: 167