Invisible Infinity

Hi gurus and nubys,

I wonder, if you divide a Float by zero, you get Infinity:
>> a=10.0/0
=> Infinity

and you can even write code using Infinity like:
>> 0.upto(a) do |x| p x end
0
1
2
3
...

but if you try to access it directly you can't:
>> Infinity
NameError: uninitialized constant Infinity
         from (irb):4

Should we be able to access Infinity directly? It seem a strange unexplicable behaviour to me, that it exists but is not normally accessible.

Hi gurus and nubys,

I wonder, if you divide a Float by zero, you get Infinity:
>> a=10.0/0
=> Infinity

and you can even write code using Infinity like:
>> 0.upto(a) do |x| p x end
0
1
2
3
...

> a = 10.0/0
=> Infinity
> b = 10.0/0
=> Infinity
> a < b
=> false
> c = 2**1024
....
> c.to_f
(irb):10: warning: Bignum out of Float range
=> Infinity

...so your example won't go forever. Eventually it will hit 'Infinity' and stop. (I think)
So maybe having access to Infinity is a bad thing??
-Charlie

If y is a double rb_big_cmp(x, y) converts x to a double (infinity if the Bignum is greator than max double) and calls rb_dbl_cmp()

numeric.c:
02323 static VALUE
02324 int_upto(from, to)
02325 VALUE from, to;
02326 {
02327 if (FIXNUM_P(from) && FIXNUM_P(to)) {
02328 long i, end;
02329
02330 end = FIX2LONG(to);
02331 for (i = FIX2LONG(from); i <= end; i++) {
02332 rb_yield(LONG2FIX(i));
02333 }
02334 }
02335 else {
02336 VALUE i = from, c;
02337
02338 while (!(c = rb_funcall(i, '>', 1, to))) {
02339 rb_yield(i);
02340 i = rb_funcall(i, '+', 1, INT2FIX(1));
02341 }
02342 if (NIL_P(c)) rb_cmperr(i, to);
02343 }
02344 return from;
02345 }

00691 VALUE
00692 rb_dbl_cmp(a, b)
00693 double a, b;
00694 {
00695 if (isnan(a) || isnan(b)) return Qnil;
00696 if (a == b) return INT2FIX(0);
00697 if (a > b) return INT2FIX(1);
00698 if (a < b) return INT2FIX(-1);
00699 return Qnil;
00700 }

···

On Sep 1, 2004, at 11:10 AM, gabriele renzi wrote:

but if you try to access it directly you can't:
>> Infinity
NameError: uninitialized constant Infinity
        from (irb):4

Should we be able to access Infinity directly? It seem a strange unexplicable behaviour to me, that it exists but is not normally accessible.

I also was surprised, that Infinity is no predefined constant, as I used
it in some algorithm where I needed to fill an Array with infinity, then
iteratively reducing the values. In these cases infinity is much better
than nil as a special value because it can be compared.

So I declared 1.0/0.0 as Infinity and ready. But I regard it as against
the pols.

Greetings,

Brian

···

On Wed, 01 Sep 2004 18:05:43 +0000, gabriele renzi wrote:

Hi gurus and nubys,

I wonder, if you divide a Float by zero, you get Infinity:
>> a=10.0/0
=> Infinity

and you can even write code using Infinity like:
>> 0.upto(a) do |x| p x end
0
1
2
3
..

but if you try to access it directly you can't:
>> Infinity
NameError: uninitialized constant Infinity
         from (irb):4

Should we be able to access Infinity directly? It seem a strange
unexplicable behaviour to me, that it exists but is not normally
accessible.

--
Brian Schröder
http://www.brian-schroeder.de/

Hi,

···

In message "invisible Infinity" on 04/09/02, gabriele renzi <rff_rff@remove-yahoo.it> writes:

Should we be able to access Infinity directly? It seem a strange
unexplicable behaviour to me, that it exists but is not normally accessible.

Considering non IEEE platform, there's no portable way to generate
Inifinity and NaN, I think. Teach me if I'm wrong.

              matz.

> Hi gurus and nubys,
>
> I wonder, if you divide a Float by zero, you get Infinity:
> >> a=10.0/0
> => Infinity
>
>
> and you can even write code using Infinity like:
> >> 0.upto(a) do |x| p x end
> 0
> 1
> 2
> 3
> ...
>

> a = 10.0/0
=> Infinity
> b = 10.0/0
=> Infinity
> a < b
=> false
> c = 2**1024

Also:

irb(main):004:0> a == b
=> true

so.. Infinity is Infinity !!
:slight_smile:

···

On Wed, 2004-09-01 at 14:40, Charles Mills wrote:

On Sep 1, 2004, at 11:10 AM, gabriele renzi wrote:

....
> c.to_f
(irb):10: warning: Bignum out of Float range
=> Infinity

...so your example won't go forever. Eventually it will hit 'Infinity'
and stop. (I think)
So maybe having access to Infinity is a bad thing??
-Charlie

If y is a double rb_big_cmp(x, y) converts x to a double (infinity if
the Bignum is greator than max double) and calls rb_dbl_cmp()

numeric.c:
02323 static VALUE
02324 int_upto(from, to)
02325 VALUE from, to;
02326 {
02327 if (FIXNUM_P(from) && FIXNUM_P(to)) {
02328 long i, end;
02329
02330 end = FIX2LONG(to);
02331 for (i = FIX2LONG(from); i <= end; i++) {
02332 rb_yield(LONG2FIX(i));
02333 }
02334 }
02335 else {
02336 VALUE i = from, c;
02337
02338 while (!(c = rb_funcall(i, '>', 1, to))) {
02339 rb_yield(i);
02340 i = rb_funcall(i, '+', 1, INT2FIX(1));
02341 }
02342 if (NIL_P(c)) rb_cmperr(i, to);
02343 }
02344 return from;
02345 }

00691 VALUE
00692 rb_dbl_cmp(a, b)
00693 double a, b;
00694 {
00695 if (isnan(a) || isnan(b)) return Qnil;
00696 if (a == b) return INT2FIX(0);
00697 if (a > b) return INT2FIX(1);
00698 if (a < b) return INT2FIX(-1);
00699 return Qnil;
00700 }

>
> but if you try to access it directly you can't:
> >> Infinity
> NameError: uninitialized constant Infinity
> from (irb):4
>
> Should we be able to access Infinity directly? It seem a strange
> unexplicable behaviour to me, that it exists but is not normally
> accessible.

--
Mohammad Khan <mkhan@lextranet.com>
Legal Computer Solutions, Inc.

If you take a look in numeric.c

/*
* call-seq:
* flt.to_s => string

···

*
* Returns a string containing a representation of self. As well as a
* fixed or exponential form of the number, the call may return
* ``<code>NaN</code>'', ``<code>Infinity</code>'', and
* ``<code>-Infinity</code>''.
*/
                                                                                                                                                             
static VALUE
flo_to_s(flt)
    VALUE flt;
{
    char buf[32];
    char *fmt = "%.15g";
    double value = RFLOAT(flt)->value;
    double avalue, d1, d2;
                                                                                                                                                             
    if (isinf(value))
        return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
    else if(isnan(value))
        return rb_str_new2("NaN");
                                                                                                                                                             
    avalue = fabs(value);
    if (avalue == 0.0) {
        fmt = "%.1f";
    }
    else if (avalue < 1.0e-3) {
        d1 = avalue;
        while (d1 < 1.0) d1 *= 10.0;
        d1 = modf(d1, &d2);
        if (d1 == 0) fmt = "%.1e";
    }
    else if (avalue >= 1.0e15) {
        d1 = avalue;
        while (d1 > 10.0) d1 /= 10.0;
        d1 = modf(d1, &d2);
        if (d1 == 0) fmt = "%.1e";
        else fmt = "%.16e";
    }
    else if ((d1 = modf(value, &d2)) == 0) {
        fmt = "%.1f";
    }
    sprintf(buf, fmt, value);
                                                                                                                                                             
    return rb_str_new2(buf);
}

Infinity and -Infinity is String and it is just a representation.
It is definitely, not a Constant.

I am wrong, correct me please.

--
Mohammad

On Wed, 2004-09-01 at 15:05, Brian Schroeder wrote:

On Wed, 01 Sep 2004 18:05:43 +0000, gabriele renzi wrote:

> Hi gurus and nubys,
>
> I wonder, if you divide a Float by zero, you get Infinity:
> >> a=10.0/0
> => Infinity
>
>
> and you can even write code using Infinity like:
> >> 0.upto(a) do |x| p x end
> 0
> 1
> 2
> 3
> ..
>
> but if you try to access it directly you can't:
> >> Infinity
> NameError: uninitialized constant Infinity
> from (irb):4
>
> Should we be able to access Infinity directly? It seem a strange
> unexplicable behaviour to me, that it exists but is not normally
> accessible.

I also was surprised, that Infinity is no predefined constant, as I used
it in some algorithm where I needed to fill an Array with infinity, then
iteratively reducing the values. In these cases infinity is much better
than nil as a special value because it can be compared.

So I declared 1.0/0.0 as Infinity and ready. But I regard it as against
the pols.

Greetings,

Brian

--
Mohammad Khan <mkhan@lextranet.com>
Legal Computer Solutions, Inc.

is it an impossible idea to map the various Nan's to some singleton like
InfinityClass - for which Infinity would be the only instance, similar to
FalseClass and TrueClass? we could also have NegativeInfinity as well.
operators for these singletons would be defined as

   class << Infinity
     def < other; false; end
     def > other; other == self ? false : true; end
   end
   class << NegativeInfinity
     def > other; false; end
     def < other; other == self ? false : true; end
   end

the reason i say this is that the notion of infinity is useful for many
things, like Time and Date, not just Numeric.

perhaps this is too hard to make generic - but it would be a very useful
paradigm to have at one's disposal.

kind regards.

-a

···

On Thu, 2 Sep 2004, Yukihiro Matsumoto wrote:

Hi,

In message "invisible Infinity" > on 04/09/02, gabriele renzi <rff_rff@remove-yahoo.it> writes:

>Should we be able to access Infinity directly? It seem a strange
>unexplicable behaviour to me, that it exists but is not normally accessible.

Considering non IEEE platform, there's no portable way to generate
Inifinity and NaN, I think. Teach me if I'm wrong.

              matz.

--

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen

===============================================================================

If you take a look in numeric.c

/*
* call-seq:
* flt.to_s => string
*
* Returns a string containing a representation of self. As well as a
* fixed or exponential form of the number, the call may return
* ``<code>NaN</code>'', ``<code>Infinity</code>'', and
* ``<code>-Infinity</code>''.
*/
                                                                                                                                                             
static VALUE
flo_to_s(flt)
    VALUE flt;
{
    char buf[32];
    char *fmt = "%.15g";
    double value = RFLOAT(flt)->value;
    double avalue, d1, d2;
                                                                                                                                                             
    if (isinf(value))
        return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
    else if(isnan(value))
        return rb_str_new2("NaN");
                                                                                                                                                             
    avalue = fabs(value);
    if (avalue == 0.0) {
        fmt = "%.1f";
    }
    else if (avalue < 1.0e-3) {
        d1 = avalue;
        while (d1 < 1.0) d1 *= 10.0;
        d1 = modf(d1, &d2);
        if (d1 == 0) fmt = "%.1e";
    }
    else if (avalue >= 1.0e15) {
        d1 = avalue;
        while (d1 > 10.0) d1 /= 10.0;
        d1 = modf(d1, &d2);
        if (d1 == 0) fmt = "%.1e";
        else fmt = "%.16e";
    }
    else if ((d1 = modf(value, &d2)) == 0) {
        fmt = "%.1f";
    }
    sprintf(buf, fmt, value);
                                                                                                                                                             
    return rb_str_new2(buf);
}

Infinity and -Infinity is String and it is just a representation.
It is definitely, not a Constant.

I am wrong, correct me please.

I meant,
If I am wrong, correct me please.

···

On Wed, 2004-09-01 at 15:22, Mohammad Khan wrote:

--
Mohammad

On Wed, 2004-09-01 at 15:05, Brian Schroeder wrote:
> On Wed, 01 Sep 2004 18:05:43 +0000, gabriele renzi wrote:
>
> > Hi gurus and nubys,
> >
> > I wonder, if you divide a Float by zero, you get Infinity:
> > >> a=10.0/0
> > => Infinity
> >
> >
> > and you can even write code using Infinity like:
> > >> 0.upto(a) do |x| p x end
> > 0
> > 1
> > 2
> > 3
> > ..
> >
> > but if you try to access it directly you can't:
> > >> Infinity
> > NameError: uninitialized constant Infinity
> > from (irb):4
> >
> > Should we be able to access Infinity directly? It seem a strange
> > unexplicable behaviour to me, that it exists but is not normally
> > accessible.
>
>
> I also was surprised, that Infinity is no predefined constant, as I used
> it in some algorithm where I needed to fill an Array with infinity, then
> iteratively reducing the values. In these cases infinity is much better
> than nil as a special value because it can be compared.
>
> So I declared 1.0/0.0 as Infinity and ready. But I regard it as against
> the pols.
>
> Greetings,
>
> Brian

--
Mohammad Khan <mkhan@lextranet.com>
Legal Computer Solutions, Inc.

If you take a look in numeric.c

<snip code>

Infinity and -Infinity is String and it is just a representation.
It is definitely, not a Constant.

I am wrong, correct me please.

What is displayed are just string representations of the value, but they are actually valid float values. Floats can be any floating point number, within a certain range, or: positive or negative Infinity (±Infinity), positive or negative Zero (±0.0), or not a number (NaN).

They are all valid float values, but there is no way to access them, aside from calculating them. I'm not sure how often they would be useful, but it does seem strange that Infinity and NaN are the only float values that you can't state directly.

cheers,
Mark

···

On Sep 1, 2004, at 12:22 PM, Mohammad Khan wrote:

--
Mohammad

On Wed, 2004-09-01 at 15:05, Brian Schroeder wrote:

On Wed, 01 Sep 2004 18:05:43 +0000, gabriele renzi wrote:

Hi gurus and nubys,

I wonder, if you divide a Float by zero, you get Infinity:

a=10.0/0

=> Infinity

and you can even write code using Infinity like:

0.upto(a) do |x| p x end

0
1
2
3
..

but if you try to access it directly you can't:

Infinity

NameError: uninitialized constant Infinity
         from (irb):4

Should we be able to access Infinity directly? It seem a strange
unexplicable behaviour to me, that it exists but is not normally
accessible.

I also was surprised, that Infinity is no predefined constant, as I used
it in some algorithm where I needed to fill an Array with infinity, then
iteratively reducing the values. In these cases infinity is much better
than nil as a special value because it can be compared.

So I declared 1.0/0.0 as Infinity and ready. But I regard it as against
the pols.

Greetings,

Brian

--
Mohammad Khan <mkhan@lextranet.com>
Legal Computer Solutions, Inc.

Just curious,

inf = 10.0/0

1.upto(inf) do | i |
# do something
end

Is this an endless loop? Logically it should be.

Mohammad

···

On Wed, 2004-09-01 at 22:10, Ara.T.Howard@noaa.gov wrote:

On Thu, 2 Sep 2004, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "invisible Infinity" > > on 04/09/02, gabriele renzi <rff_rff@remove-yahoo.it> writes:
>
> >Should we be able to access Infinity directly? It seem a strange
> >unexplicable behaviour to me, that it exists but is not normally accessible.
>
> Considering non IEEE platform, there's no portable way to generate
> Inifinity and NaN, I think. Teach me if I'm wrong.
>
> matz.

is it an impossible idea to map the various Nan's to some singleton like
InfinityClass - for which Infinity would be the only instance, similar to
FalseClass and TrueClass? we could also have NegativeInfinity as well.
operators for these singletons would be defined as

   class << Infinity
     def < other; false; end
     def > other; other == self ? false : true; end
   end
   class << NegativeInfinity
     def > other; false; end
     def < other; other == self ? false : true; end
   end

the reason i say this is that the notion of infinity is useful for many
things, like Time and Date, not just Numeric.

perhaps this is too hard to make generic - but it would be a very useful
paradigm to have at one's disposal.

kind regards.

-a
--

> EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
> PHONE :: 303.497.6469
> A flower falls, even though we love it;
> and a weed grows, even though we do not love it.
> --Dogen

--
Mohammad Khan <mkhan@lextranet.com>
Legal Computer Solutions, Inc.

Hi,

At Thu, 2 Sep 2004 11:10:21 +0900,
Ara.T.Howard@noaa.gov wrote in [ruby-talk:111227]:

the reason i say this is that the notion of infinity is useful for many
things, like Time and Date, not just Numeric.

Isn't it Eternity rather than Infinity? :slight_smile:

···

--
Nobu Nakada

I am not sure if this is what you meant, but Infinity is not a string:

(10.0/0).class
=> Float

(10.0/0).to_s.class
=> String

Regards,
KB

···

On Thu, 02 Sep 2004 04:25:57 +0900, Mohammad Khan wrote:

On Wed, 2004-09-01 at 15:22, Mohammad Khan wrote:

If you take a look in numeric.c

/*
* call-seq:
* flt.to_s => string
*
* Returns a string containing a representation of self. As well as a *
  fixed or exponential form of the number, the call may return *
``<code>NaN</code>'', ``<code>Infinity</code>'', and *
``<code>-Infinity</code>''.
*/
                                                                                                                                                             
static VALUE
flo_to_s(flt)
    VALUE flt;
{
    char buf[32];
    char *fmt = "%.15g";
    double value = RFLOAT(flt)->value;
    double avalue, d1, d2;
                                                                                                                                                             
    if (isinf(value))
        return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
    else if(isnan(value))
        return rb_str_new2("NaN");
                                                                                                                                                             
    avalue = fabs(value);
    if (avalue == 0.0) {
        fmt = "%.1f";
    }
    else if (avalue < 1.0e-3) {
        d1 = avalue;
        while (d1 < 1.0) d1 *= 10.0;
        d1 = modf(d1, &d2);
        if (d1 == 0) fmt = "%.1e";
    }
    else if (avalue >= 1.0e15) {
        d1 = avalue;
        while (d1 > 10.0) d1 /= 10.0;
        d1 = modf(d1, &d2);
        if (d1 == 0) fmt = "%.1e";
        else fmt = "%.16e";
    }
    else if ((d1 = modf(value, &d2)) == 0) {
        fmt = "%.1f";
    }
    sprintf(buf, fmt, value);
                                                                                                                                                             
    return rb_str_new2(buf);
}
}
Infinity and -Infinity is String and it is just a representation. It is
definitely, not a Constant.

I am wrong, correct me please.

I meant,
If I am wrong, correct me please.

No, Eternity is the amount of time one has to wait when one is in line
behind fifteen people at the grocery store with a cashier that doesn't
speak one's native language, everyone having a full cart, and everyone
wanting to pay by cheque.

-austin

···

On Fri, 3 Sep 2004 00:07:31 +0900, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:

At Thu, 2 Sep 2004 11:10:21 +0900,
Ara.T.Howard@noaa.gov wrote in [ruby-talk:111227]:
> the reason i say this is that the notion of infinity is useful for many
> things, like Time and Date, not just Numeric.
Isn't it Eternity rather than Infinity? :slight_smile:

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca
: as of this email, I have [ 6 ] Gmail invitations

i like that!

   class << Time

     Eternity = ::Infinity
     NegativeEternity = ::NegativeInfinity

   end

i got the 'infinity' nomenclature from bi-temporal database terminology and
postgres.

-a

···

On Fri, 3 Sep 2004 nobu.nokada@softhome.net wrote:

Hi,

At Thu, 2 Sep 2004 11:10:21 +0900,
Ara.T.Howard@noaa.gov wrote in [ruby-talk:111227]:

the reason i say this is that the notion of infinity is useful for many
things, like Time and Date, not just Numeric.

Isn't it Eternity rather than Infinity? :slight_smile:

--

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen

===============================================================================

>> If you take a look in numeric.c
>>
>>
>> /*
>> * call-seq:
>> * flt.to_s => string
>> *
>> * Returns a string containing a representation of self. As well as a *
>> fixed or exponential form of the number, the call may return *
>> ``<code>NaN</code>'', ``<code>Infinity</code>'', and *
>> ``<code>-Infinity</code>''.
>> */
>>
>> static VALUE
>> flo_to_s(flt)
>> VALUE flt;
>> {
>> char buf[32];
>> char *fmt = "%.15g";
>> double value = RFLOAT(flt)->value;
>> double avalue, d1, d2;
>>
>> if (isinf(value))
>> return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
>> else if(isnan(value))
>> return rb_str_new2("NaN");
>>
>> avalue = fabs(value);
>> if (avalue == 0.0) {
>> fmt = "%.1f";
>> }
>> else if (avalue < 1.0e-3) {
>> d1 = avalue;
>> while (d1 < 1.0) d1 *= 10.0;
>> d1 = modf(d1, &d2);
>> if (d1 == 0) fmt = "%.1e";
>> }
>> else if (avalue >= 1.0e15) {
>> d1 = avalue;
>> while (d1 > 10.0) d1 /= 10.0;
>> d1 = modf(d1, &d2);
>> if (d1 == 0) fmt = "%.1e";
>> else fmt = "%.16e";
>> }
>> else if ((d1 = modf(value, &d2)) == 0) {
>> fmt = "%.1f";
>> }
>> sprintf(buf, fmt, value);
>>
>> return rb_str_new2(buf);
>> }
>> }
>> Infinity and -Infinity is String and it is just a representation. It is
>> definitely, not a Constant.
>>
>> I am wrong, correct me please.
>
> I meant,
> If I am wrong, correct me please.
>

I am not sure if this is what you meant, but Infinity is not a string:

(10.0/0).class
=> Float

(10.0/0).to_s.class
=> String

irb(main):001:0> a = 10.0/0
=> Infinity
irb(main):002:0> b = -20.0/0
=> -Infinity

I said, Infinity and -Infinity is just a String representation of Float,
not a Constant.

regards
Mohammad

···

On Wed, 2004-09-01 at 15:55, Kristof Bastiaensen wrote:

On Thu, 02 Sep 2004 04:25:57 +0900, Mohammad Khan wrote:
> On Wed, 2004-09-01 at 15:22, Mohammad Khan wrote:

Regards,
KB

>> If you take a look in numeric.c
>>
>>
>> /*
>> * call-seq:
>> * flt.to_s => string
>> *
>> * Returns a string containing a representation of self. As well as
>> a *
>> fixed or exponential form of the number, the call may return *
>> ``<code>NaN</code>'', ``<code>Infinity</code>'', and *
>> ``<code>-Infinity</code>''.
>> */
>>
>> static VALUE
>> flo_to_s(flt)
>> VALUE flt;
>> {
>> char buf[32];
>> char *fmt = "%.15g";
>> double value = RFLOAT(flt)->value;
>> double avalue, d1, d2;
>>
>> if (isinf(value))
>> return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
>> else if(isnan(value))
>> return rb_str_new2("NaN");
>>
>> avalue = fabs(value);
>> if (avalue == 0.0) {
>> fmt = "%.1f";
>> }
>> else if (avalue < 1.0e-3) {
>> d1 = avalue;
>> while (d1 < 1.0) d1 *= 10.0;
>> d1 = modf(d1, &d2);
>> if (d1 == 0) fmt = "%.1e";
>> }
>> else if (avalue >= 1.0e15) {
>> d1 = avalue;
>> while (d1 > 10.0) d1 /= 10.0;
>> d1 = modf(d1, &d2);
>> if (d1 == 0) fmt = "%.1e";
>> else fmt = "%.16e";
>> }
>> else if ((d1 = modf(value, &d2)) == 0) {
>> fmt = "%.1f";
>> }
>> sprintf(buf, fmt, value);
>>
>> return rb_str_new2(buf);
>> }
>> }
>> Infinity and -Infinity is String and it is just a representation. It
>> is definitely, not a Constant.
>>
>> I am wrong, correct me please.
>
> I meant,
> If I am wrong, correct me please.
>
>
I am not sure if this is what you meant, but Infinity is not a string:

(10.0/0).class
=> Float

(10.0/0).to_s.class
=> String

irb(main):001:0> a = 10.0/0
=> Infinity
irb(main):002:0> b = -20.0/0
=> -Infinity

I said, Infinity and -Infinity is just a String representation of Float,
not a Constant.

So it is not what you meant then :slight_smile:
It wasn't clear to me you where talking about irb output.
Sorry for the confusion.

···

On Thu, 02 Sep 2004 05:08:44 +0900, Mohammad Khan wrote:

On Wed, 2004-09-01 at 15:55, Kristof Bastiaensen wrote:

On Thu, 02 Sep 2004 04:25:57 +0900, Mohammad Khan wrote:
> On Wed, 2004-09-01 at 15:22, Mohammad Khan wrote:

regards
Mohammad

Regards,
KB

Mohammad Khan wrote:

I said, Infinity and -Infinity is just a String representation of Float,
not a Constant.

Yes, that's exactly the objection of the original poster. He wants it to be a constant so it can be accessed easily.

regards
Mohammad

More regards,
Florian Gross