[Top][All Lists]

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

IEEE-754 binary rep functions

From: Heinz Eriksson
Subject: IEEE-754 binary rep functions
Date: Tue, 22 Oct 2002 08:20:55 +0200

How would one write elisp functions to convert
to and from the binary representation of a
IEEE-754 (single precision) floating point number?
I don't care about NaN etc.


#The perl would be something like:
$number = 1.0;
$binrep = unpack("H8",pack("F", $number))
# 3f800000 on a big-endian
$float = unpack("F",pack("H8", $binrep))
# back to 1.0

reply via email to

[Prev in Thread] Current Thread [Next in Thread]