[fpc-pascal] License question; unit to view floating-point details

Tom Verhoeff T.Verhoeff at tue.nl
Sun Sep 7 12:15:09 CEST 2008


On Sat, Sep 06, 2008 at 09:31:02PM +0200, Florian Klaempfl wrote:
>>
>> What would I need to do to release it under the same license as
>> other FreePascal libraries?
>
> Post the sources somewhere using the license header we use?

I intend to do just that.  I was considering the use of plain GPL,
rather than LGPL.  However, I wonder if that would interfere with the
incorporation into FreePascal.

Is it the case that all FPC libraries use (a variant of) LGPL?
I am willing to use that license, but if GPL is an option, I would
prefer that.

>> Would there be any interest in incorporating it?
>
> If it's endian safe and if there are tests, I propose to incoperate it  
> in math.

The old version initially was not, and the next version resolved
that through conditional compilation.  It used a set-of construct
to access the bits of floating-point numbers.

The current version is safe on most "reasonable" processors.

Let me explain.  I use 32-bit (Cardinal) and 64-bit (QWord) integers
to access the bits of Single/Double values.  The IEEE 754 standard
format for floating-point numbers was specifically designed to allow
the use of some integer operations on the representation to implement
some floating-point operations, because this gives an opportunity to save
on hardware.  In particular, succ and pred on the floating-point number
bit pattern _interpreted_as_integer_ will yield the next larger/smaller
floating-point number.

Therefore, I believe that my current implemenation is endian-safe
on processors that exploit the IEEE 754 standard wisely.

In particular, I tested it on Intel and PowerPC (which have opposite
endianness; though PowerPC can switch endianness).

The unit comes with a separate test driver.  There are also some examples.

	Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL     | Dept. of Math. & Comp. Science
PHONE:  +31 40 247 41 25        | Technische Universiteit Eindhoven
FAX:    +31 40 247 54 04        | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands



More information about the fpc-pascal mailing list