[GiNaC-list] Possible size issue in test in numeric.cpp

Richard B. Kreckel kreckel at ginac.de
Wed Aug 16 23:19:54 CEST 2006


Hi!

Pierangelo Masarati wrote:

> Looking at recent CLN stuff, I see that the internal representation of 
> any type of data is a word, which is basically a "cl_uint" (in 
> cln/object.h:
> typedef uintP  cl_uint;  // This ought to be called `cl_word'.
> where
> typedef unsigned long  uintP;
> :)
> It doesn't really care about signedness until the value is extracted 
> and shifted back to its position.


Correct.

> I haven't looked into CLN's CVS yet, though, but this looks like 
> something that shouldn't change quite often.


Correct.

> However, since applications using CLN shouldn't be aware of those 
> details, I'm getting convinced that the optimization you're trying to 
> obtain in numeric.cpp should actually be moved to CLN, in the sense 
> that being CLN a likely candidate as a building block for higher-level 
> numerical libraries (like GiNaC, for example), it should provide means 
> for safe and efficient machine and OS independent conversion between 
> its internal representation and built-in types.  Details about how to 
> implement it are beyond the scope of this message; it could be by 
> providing standard limits for the builtin types (like INT_MAX, 
> UNIT_MAX and so in limits.h) or a test (sort of SAFE_CAST_TO_INT(x), 
> SAFE_CAST_TO_UINT(x) and similar) or so.


This is documented in chapter 3.4 "Conversions".

Cheers
   -richy.

-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>



More information about the GiNaC-list mailing list