Karim Belabas on Thu, 21 Jun 2012 16:28:11 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Infinity


* Dirk Laurie [2012-06-21 15:20]:
> Can a Pari object Inf be constructed with the property
> that x<Inf is true for all t_REAL x?

Rather a hack, but you can use any character string (t_STR): it is considered
larger than any non-string type. 

So you could define INFINITY = "" [ GP ] / strtoGENstr("") [ library mode ],
for instance. Then

(15:40) gp > Pi < INFINITY
%1 = 1
(15:41) gp > 10^6 < INFINITY
%2 = 1
(15:41) gp > INFINITY < INFINITY
%3 = 0

Unfortunately,

1) there is no way to define -INFINITY, or use this in any actual
computation besides comparison (e.g. INFINITY + INFINITY, etc.).

2) this is inconsistent with intnum() arguments 


It would be nicer to have \pm\infty both as genuine t_REALs. Just like
for C double, we could decide that a specific exponent value correspond
to (plus or minus depending on sign) Infinity. 

Minor drawback: in the most natural implementation, we would lose one
currently valid exponent value [ -2^61, resp. -2^29, on 64-bit, resp 32-bit
machines ]

Minor advantage: the range of permissible exponent values would become
symmetric, e.g. [-2^61 - 1, 2^61 - 1] instead of (current) [-2^61, 2^61-1].


Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`