Skip to content

Latest commit

 

History

History
237 lines (147 loc) · 8.09 KB

File-src-minisql-common-float-codec-ml-1746004680.md

File metadata and controls

237 lines (147 loc) · 8.09 KB

src/minisql/common/float_codec.ml

Home · Files

Exact finite IEEE-754 binary64 codecs for persistent MiniSQL values.

Package: minisql.common.float_codec

Reachable from entry: yes

Imports

  • minisql/common/endian.ml as endian → src/minisql/common/endian.ml
  • std/math.ml as math → ../MiniLangCompilerML/std/math.ml — external dependency

Declarations

componentName

function componentName()

Returns this module's stable registry name.

View source

CORRUPT_DATA

const CORRUPT_DATA = 9004

View source

decodeFloat64LE

function decodeFloat64LE(source, offset)

Decodes finite binary64, preserving negative zero and the full 53-bit significand.

Parameter Type Default Description
source dynamic — Input byte buffer.
offset dynamic — Start of the eight-byte value.

View source

encodeFloat64LE

function encodeFloat64LE(value)

Encodes a finite number without changing zero's sign or losing subnormal bits.

Parameter Type Default Description
value dynamic — MiniLang numeric value; integers convert to binary64 by normal numeric semantics.

View source

FRACTION_UNIT

const FRACTION_UNIT = 4503599627370496

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

View source

isFiniteEncoded

function isFiniteEncoded(source, offset)

Reports whether an encoded binary64 has a finite exponent, after bounds checks.

Parameter Type Default Description
source dynamic — Input byte buffer.
offset dynamic — Start of the eight-byte value.

View source

isImplemented

function isImplemented()

Reports that the binary64 codec is available.

View source

nativeCopySign

extern function nativeCopySign(value as double, signValue as double) from "msvcrt.dll" symbol "_copysign" returns double

Copies the sign bit, including the sign of zero.

Parameter Type Default Description
value double —
signValue double —

View source

nativeFinite

extern function nativeFinite(value as double) from "msvcrt.dll" symbol "_finite" returns i32

Reports whether the native value is finite without unordered comparisons.

Parameter Type Default Description
value double —

View source

nativeFrexp

extern function nativeFrexp(value as double, exponent as bytes) from "msvcrt.dll" symbol "frexp" returns double

Splits a native double into its exact binary significand and exponent.

Parameter Type Default Description
value double —
exponent bytes —

View source

nativeLdexp

extern function nativeLdexp(value as double, exponent as i32) from "msvcrt.dll" symbol "ldexp" returns double

Scales a native double by an integral power of two.

Parameter Type Default Description
value double —
exponent i32 —

View source

targetMilestone

function targetMilestone()

Returns the storage generation that introduced this module.

View source

TYPE_MISMATCH

const TYPE_MISMATCH = 9017

View source

WIDTH

const WIDTH = 8

View source

writeFloat64LE

function writeFloat64LE(destination, offset, value)

Writes a complete finite binary64 only after value and destination validation.

Parameter Type Default Description
destination dynamic — Output byte buffer.
offset dynamic — Start of the eight-byte destination.
value dynamic — Numeric value to encode.

View source