> Tom St Denis a écrit :
>
> Basically there are two types of bignums support:
>
> Integers only support or some kind of "floating" point
> support.
Perhaps. Or only floating point support (the package from Richard Brent).
> This is a design decision for the builders of
> the package. You decided to support only integers,
> then there is no point in setting sizeof(bignum int) in
> your library.
For integers there is no need to setting size. This is independent on
whether you also support floating point or not.
> I decided to support "floating" point, i.e. to represent the bignums
> by a ratio of two indefinitely long integers.
That is *not* floating point, and in most cases can not be suitably used
as a substitute for floating point, as it does not conform to common
requirements from numerical mathematics about floating point (a minimal
exponent range compared to the number of mantissa digits). It is also
not floating slash (a representation of rationals where the numerator
and denominator together occupy about the same amount of storage). It
is a representation of the rationals with fixed limit on the size of
numerator and denominator.
When you represent real numbers with them you get a terribly wobbling
precision. Moreover you will have problems to correctly define what
the operations on such numbers do when the result does not fit in the
representation. Consider such a representation with a single decimal
digit for numerator and denominator. What is the result of 1/9 + 1/8?
Is it 2/9 or 1/4 after rounding? Does 1/9 + 1/7 properly round to 1/4?
And 1/9 + 1/7 to 1/6? So your package is not suitable for numerical
mathematics. Thanks for the warning.
> Then, the user must decide
> which size should those numbers have. Then, (and we come here to the
> original thread) there is a concrete sense in setting sizeof(int).
And that is your problem, you conflate them both in the same type.