Boost logo

Boost :

Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: DE (satan66613_at_[hidden])
Date: 2010-04-03 06:11:42


let me try to summarize arguments for infinities and other stuff

assumption: it'll be convenient if a thing, upon which some another
thing would be built, provide natively some features which would be
useful only in the implementation of that other thing built on top
of it

this looks like some kind of an inversion or degeneralization
sure the prime thing shoud provied complete set of functionality with
wich any other extension can be built
but since the prime thing is not generally aware of other things which
could be built around it it should not provide any feature which would
*possibly* be useful

assumption: there should be signed zeros like that of ieee floating
point numbers

floating point numbers is the generalization of integers but not
the other way round
i think you forgot that
trying to make integer behavior similar to that of floating point
numbers is wrong imho
that's why you have no sound argument for this -- because it's not
natural for ints

assumption: the presence of (signed) infinities would provide ultimate
set of relationships of the domain entities as well as consistence of
some operations' behavior

since there was no example of an application of infinities except
interval arithmetics i see no reason to provide it

considering intervals
if we use floating point numbers we can define an interval as
(-inf; +inf)
here a finite number of distinct values fill the interval

when we use ordinary ints we define it possibly as (-MAX_INT; MAX_INT)
or even [-MAX_INT; MAX_INT] (including endpoints)
notice lack of infinities here
here as well we have finite number of values filling the interval,
namely 2^(sizeof(int)*8)

so to be consistent we should define an interval for xint as
(-SaneBigValue; SaneBigValue)
only this way the interval would be useful (considering finite memory,
time etc.)
the provision of infinities would render such interval unuseful since
there would be a strong possibility of popping of an unrepresentable
number during computations (unrepresentable due to memory limitations)
moreover in that situation it would be inexact -> no need to use the
lib at all, better use floating point numbers

so i still don't see any sane application of infinities in a integer
domain and hence the need of infinities at all

-- 
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