all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* IEEE-754 binary rep functions
@ 2002-10-22  6:20 Heinz Eriksson
  2002-10-23 14:19 ` Ehud Karni
  0 siblings, 1 reply; 2+ messages in thread
From: Heinz Eriksson @ 2002-10-22  6:20 UTC (permalink / raw)


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.

/hz

#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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-23 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-22  6:20 IEEE-754 binary rep functions Heinz Eriksson
2002-10-23 14:19 ` Ehud Karni

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.