aboutsummaryrefslogtreecommitdiffstats
path: root/bytenumb.txi
diff options
context:
space:
mode:
Diffstat (limited to 'bytenumb.txi')
-rw-r--r--bytenumb.txi12
1 files changed, 12 insertions, 0 deletions
diff --git a/bytenumb.txi b/bytenumb.txi
index 67c340b..9be7630 100644
--- a/bytenumb.txi
+++ b/bytenumb.txi
@@ -28,6 +28,7 @@ bytes are treated as two's-complement (can be negative).
@end example
@end defun
+
@defun integer->bytes n len
Converts the integer @var{n} to a byte-array of @code{(abs @var{n})}
@@ -44,11 +45,13 @@ returned array are coded two's-complement.
@end example
@end defun
+
@defun bytes->ieee-float bytes
@var{bytes} must be a 4-element byte-array. @code{bytes->ieee-float} calculates and returns the
value of @var{bytes} interpreted as a big-endian IEEE 4-byte (32-bit) number.
@end defun
+
@example
(bytes->ieee-float (bytes #x40 0 0 0)) @result{} 2.0
(bytes->ieee-float (bytes #x40 #xd0 0 0)) @result{} 6.5
@@ -69,6 +72,7 @@ value of @var{bytes} interpreted as a big-endian IEEE 4-byte (32-bit) number.
@var{bytes} must be a 8-element byte-array. @code{bytes->ieee-double} calculates and returns the
value of @var{bytes} interpreted as a big-endian IEEE 8-byte (64-bit) number.
@end defun
+
@example
(bytes->ieee-double (bytes 0 0 0 0 0 0 0 0)) @result{} 0.0
(bytes->ieee-double (bytes #x40 0 0 0 0 0 0 0)) @result{} 2
@@ -90,6 +94,7 @@ value of @var{bytes} interpreted as a big-endian IEEE 8-byte (64-bit) number.
Returns a 4-element byte-array encoding the IEEE single-precision
floating-point of @var{x}.
@end defun
+
@example
(bytes->list (ieee-float->bytes 2.0)) @result{} (64 0 0 0)
(bytes->list (ieee-float->bytes 6.5)) @result{} (64 208 0 0)
@@ -110,6 +115,7 @@ floating-point of @var{x}.
Returns a 8-element byte-array encoding the IEEE double-precision
floating-point of @var{x}.
@end defun
+
@example
(bytes->list (ieee-double->bytes 2.0)) @result{} (64 0 0 0 0 0 0 0)
(bytes->list (ieee-double->bytes 6.5)) @result{} (64 26 0 0 0 0 0 0)
@@ -149,6 +155,7 @@ two's-complement byte-vectors matches numerical order. @code{integer-byte-colla
@var{byte-vector} and is its own functional inverse.
@end deffn
+
@defun integer-byte-collate byte-vector
Returns copy of @var{byte-vector} with sign bit modified so that @code{string<?}
@@ -156,26 +163,31 @@ ordering of two's-complement byte-vectors matches numerical order.
@code{integer-byte-collate} is its own functional inverse.
@end defun
+
@deffn {Procedure} ieee-byte-collate! byte-vector
Modifies @var{byte-vector} so that @code{string<?} ordering of IEEE floating-point
byte-vectors matches numerical order. @code{ieee-byte-collate!} returns @var{byte-vector}.
@end deffn
+
@deffn {Procedure} ieee-byte-decollate! byte-vector
Given @var{byte-vector} modified by @code{IEEE-byte-collate!}, reverses the @var{byte-vector}
modifications.
@end deffn
+
@defun ieee-byte-collate byte-vector
Returns copy of @var{byte-vector} encoded so that @code{string<?} ordering of IEEE
floating-point byte-vectors matches numerical order.
@end defun
+
@defun ieee-byte-decollate byte-vector
Given @var{byte-vector} returned by @code{IEEE-byte-collate}, reverses the @var{byte-vector}
modifications.
@end defun
+