Math: export_int, export_real, export_real32, import_int, import_real, import_real32: conversion to and from external representation include "math.m"; math := load Math Math->PATH; export_int: fn(b: array of byte, x: array of int); export_real32: fn(b: array of byte, x: array of real); export_real: fn(b: array of byte, x: array of real); import_int: fn(b: array of byte, x: array of int); import_real32: fn(b: array of byte, x: array of real); import_real: fn(b: array of byte, x: array of real);These routines convert between Limbo's internal representa‐tion of integer and floating-point values, and equivalentexternal representations as arrays of bytes, allowing effi‐cient input/output of binary representations.Export_int(b, x) converts each integer element of array xinto a sequence of 4 bytes in array b.Export_real(b, x) converts each double-precision floating-point element of array x into a sequence of 8 bytes in arrayb.Export_real32(b, x) converts each double-precision floating-point element of array x to a single-precision value, thenencodes it as a sequence of 4 bytes in array b.Each import_T operation reverses the transformation of thecorresponding export_T operation, converting an array ofbytes containing a sequence of external representations intoan array of values of the appropriate internal form.Values are encoded in big-endian order (most significant bytefirst), with floating-point values represented in IEEE 32-bitor 64-bit form (again, most significant byte first).== source/libinterp/math.c== see ALSOmath-intro(2)
Math: export_int, export_real, export_real32, import_int, import_real, import_real32: conversion to and from external representation
include "math.m";
math := load Math Math->PATH;
export_int: fn(b: array of byte, x: array of int);
export_real32: fn(b: array of byte, x: array of real);
export_real: fn(b: array of byte, x: array of real);
import_int: fn(b: array of byte, x: array of int);
import_real32: fn(b: array of byte, x: array of real);
import_real: fn(b: array of byte, x: array of real);
These routines convert between Limbo's internal representa‐
tion of integer and floating-point values, and equivalent
external representations as arrays of bytes, allowing effi‐
cient input/output of binary representations.
Export_int(b, x) converts each integer element of array x
into a sequence of 4 bytes in array b.
Export_real(b, x) converts each double-precision floating-
point element of array x into a sequence of 8 bytes in array
b.
Export_real32(b, x) converts each double-precision floating-
point element of array x to a single-precision value, then
encodes it as a sequence of 4 bytes in array b.
Each import_T operation reverses the transformation of the
corresponding export_T operation, converting an array of
bytes containing a sequence of external representations into
an array of values of the appropriate internal form.
Values are encoded in big-endian order (most significant byte
first), with floating-point values represented in IEEE 32-bit
or 64-bit form (again, most significant byte first).
== source
/libinterp/math.c
== see ALSO
math-intro(2)