On 7/22/06, hadley wickham [email protected] wrote:

```
from (irb):87
from :0
```

is it possible to directly access/create a float representing positive

or negative infinity?

Thanks,

Hadley

#!/usr/bin/ruby

InfinityClass = Class.new

Infinity = InfinityClass.new

class << InfinityClass

def new; Infinity end

end

class InfinityClass

def method_missing(name, *args, &blk )

Infinity

end

def to_s; “biiig”; end

end

puts Infinity

puts Infinity + 1

puts 3 * Infinity

unfortunately in order to make the last work you have to redefine

Fixnum#*

etc etc which does not

seem pratical and I suppose that Infinity should be returned under

certain

circumstances which means that

in an expression like

a op b, b could easily be Infinity

Cheers

Robert

Infinity = " a heck of a long time"

# Sorry could not resist

## I suppose you would like things like

Infinity * 3 = Infinity etc. etc.

Deux choses sont infinies : l’univers et la bÃªtise humaine ; en ce qui

concerne l’univers, je n’en ai pas acquis la certitude absolue.