# [racket] Exact Infinity?

 From: Neil Toronto (neil.toronto at gmail.com) Date: Tue Mar 4 15:07:23 EST 2014 Previous message: [racket] Exact Infinity? Next message: [racket] Embedding Racket raco ctool --c-mods Messages sorted by: [date] [thread] [subject] [author]

```This is a good point. Do you need the first countable ordinal ω
("omega"), or an object introduced by a compactification of a
topological space? My proposal was for adding the latter.

They're different kinds of infinities, with different properties. For
example, there's no -ω. (Well, unless you define it. It might represent
something weird like the length of infinite "anti"-lists. Whatever those
might be.)

When you write "size," do you mean length or cardinality? If you mean
length, just having +inf or ω may not be enough: the length of two
infinite lists appended together is ω + ω, a strictly larger infinity.
If you're only concerned with the cardinality of all the elements as a
set, though, just having +inf or ω would work out: the number of
elements of two infinite lists appended together is just ω.

Or if you never append these infinite things whose size you're keeping
track of, or always interleave them to combine them, just +inf or ω
would be fine as well.

Neil ⊥

On 03/04/2014 10:54 AM, J. Ian Johnson wrote:
> It's a bit of a philosophical problem to have an "exact" infinity. Writing your own such wrappers should not be too much work. I've done similar constructions in my own work in analysis, simply using the symbol 'ω for infinity.
> -Ian
> ----- Original Message -----
> From: "Max New" <maxsnew at gmail.com>
> To: users at racket-lang.org
> Sent: Tuesday, March 4, 2014 12:08:03 PM GMT -05:00 US/Canada Eastern
> Subject: [racket] Exact Infinity?
>
>
>
>
> I've been doing some work that uses a data structure that includes a size that can be either a Natural number of Infinity ,a so-called "extended natural number".
>
>
> I've been using +inf.0 and gotten by using `<` and `infinite?` and things have worked fine out of the box but now I need to take the minimum of such numbers, but
>
>
>> (min 0 +inf.0)
> returns 0.0, an inexact 0. This behavior is expected: http://docs.racket-lang.org/reference/generic-numbers.html?q=inf&q=min&q=min&q=list/c&q=-%3E&q=define/contract#%28def._%28%28quote._~23~25kernel%29._min%29%29 because +inf.0 (and +inf.f) is a floating point number and thus inexact.
>
>
> I need to use exact naturals throughout however, so I can write a wrapper that takes the floor of the number after a call to min or I can define my own min that returns the original arguments.
>
>
>
> (define (mymin a b)
> (if (< a b) a b))
>
>
> But would it be useful if exact infinities were added to the numeric tower? I'll call them +inf and -inf. Most operations like +, * etc could be defined easily though you would probably also want to add an "exact" nan for say (+ +inf -inf). The operations would work exactly the same way they do for inexact infinities, except returning exact numbers when possible, so for example
>
>
> (1 . / . +inf) ==> 0
> (min 34 +inf) ==> 34
>
>
> -Max Stewart New
>
> ____________________
>    Racket Users list:
>    http://lists.racket-lang.org/users
>
> ____________________
>    Racket Users list:
>    http://lists.racket-lang.org/users
>

```

 Posted on the users mailing list. Previous message: [racket] Exact Infinity? Next message: [racket] Embedding Racket raco ctool --c-mods Messages sorted by: [date] [thread] [subject] [author]