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

Tom Verhoeff T.Verhoeff at tue.nl
Fri Sep 5 21:52:41 CEST 2008


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?

Would there be any interest in incorporating it?

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
-- 
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