Boost logo

Boost :

Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: DE (satan66613_at_[hidden])
Date: 2010-04-02 14:31:52


on 02.04.2010 at 22:07
 Scott McMurray wrote :
> Actually, you *can* calculate with infinity. That's the reason for
> having it separate from NaN, and why it needs a sign. Any operation
> with NaN gives a NaN, but at least the following for Infs don't give
> NaNs (for any x, y where is_finite(x) && !is_nan(y)):

> -(Inf) => -Inf
> -(-Inf) => Inf
> x + Inf => Inf
> x - Inf => -Inf
> x % Inf => x
> Inf + Inf => Inf
> -Inf - Inf => -Inf
> x < Inf => true
> x > -Inf => true
> y <= Inf => true
> y >= -Inf => true
> x / Inf => 0
> x / -Inf => 0
> if (y != 0) y * Inf => sign(y)Inf
> if (y != 0) y * -Inf => sign(-y)Inf

> But the indeterminate forms do, of course, give NaNs:

> Inf - Inf => NaN
> -Inf + Inf => NaN
> 0 * Inf => NaN
> 0 * -Inf => NaN
> Inf / Inf => NaN
> Inf / -Inf => NaN
> Inf % y => NaN

i can not imagine any circumstances under which this stuff would be
useful
can you?

i see main applications of a big int lib as convenient implementation
of crypto algorithms, compression algos and building an arbitrary
precision floating (or fixed) point environment
floating/fixed points built on top of a big int deal with infs and all
that stuff beside the big int
and remaining two cases don't need infs at all
so what's on *your* mind?

apart from that the presence of infs complicates things -- both
the conception and the implementation

-- 
Pavel
P.S.
if you notice a grammar mistake or weird phrasing in my message
please point it out

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk