[fpc-pascal] License question; unit to view floating-point details
Florian Klaempfl
florian at freepascal.org
Sat Sep 6 21:31:02 CEST 2008
Tom Verhoeff schrieb:
> I have a created a unit FloatView to help you inspect in detail 32-bit
> (Single) and 64-bit (Double) IEEE 754 floating-point values (in case
> "every bit counts; note that when floating-point numbers are output in
> decimal, some information is inevitably lost).
>
> I would like to contribute this unit, and offer it for further integration
> into FreePascal.
>
> 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?
>
> 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.
>
> Here are the supported operations (for Single; a similar set exists
> for Double):
>
> function SingleToStrBits ( const x: Single ): String;
> { returns string with bits for sign, biased exponent, and fraction }
> function SingleToStrBinary ( const x: Single ): String;
> { returns string with binary scientific representation of x:
> NaN, +/-Infinity, +/-B.B___Bd+/-E, where
> 'B' is a bit, 'd' stands for '*2^' and 'E' is the exponent in decimal }
> function PowerOf2Single ( const x: Single; n: Integer ): Single;
> { returns x * 2 ^ n }
> procedure FlipBitSingle ( var x: Single; i: BitIndexSingle );
> { flips bit i of x }
> function SuccSingle ( const x: Single): Single;
> { returns successor of x }
> function PredSingle ( const x: Single): Single;
> { returns predecessor of x }
>
> Best regards,
>
> Tom
More information about the fpc-pascal
mailing list