https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/syntax/values.html#floating-point
const ( // F32CanonicalNaNBits is the 32-bit float where payload's MSB equals 1 and others are all zero. F32CanonicalNaNBits = uint32(0x7fc0_0000) // F32CanonicalNaNBitsMask can be used to judge the value `v` is canonical nan as "v&F32CanonicalNaNBitsMask == F32CanonicalNaNBits" F32CanonicalNaNBitsMask = uint32(0x7fff_ffff) // F64CanonicalNaNBits is the 64-bit float where payload's MSB equals 1 and others are all zero. F64CanonicalNaNBits = uint64(0x7ff8_0000_0000_0000) // F64CanonicalNaNBitsMask can be used to judge the value `v` is canonical nan as "v&F64CanonicalNaNBitsMask == F64CanonicalNaNBits" F64CanonicalNaNBitsMask = uint64(0x7fff_ffff_ffff_ffff) // F32ArithmeticNaNPayloadMSB is used to extract the most significant bit of payload of 32-bit arithmetic NaN values F32ArithmeticNaNPayloadMSB = uint32(0x0040_0000) // F32ExponentMask is used to extract the exponent of 32-bit floating point. F32ExponentMask = uint32(0x7f80_0000) // F32ArithmeticNaNBits is an example 32-bit arithmetic NaN. F32ArithmeticNaNBits = F32CanonicalNaNBits | 0b1 // Set first bit to make this different from the canonical NaN. // F64ArithmeticNaNPayloadMSB is used to extract the most significant bit of payload of 64-bit arithmetic NaN values F64ArithmeticNaNPayloadMSB = uint64(0x0008_0000_0000_0000) // F64ExponentMask is used to extract the exponent of 64-bit floating point. F64ExponentMask = uint64(0x7ff0_0000_0000_0000) // F64ArithmeticNaNBits is an example 64-bit arithmetic NaN. F64ArithmeticNaNBits = F64CanonicalNaNBits | 0b1 // Set first bit to make this different from the canonical NaN. )
func WasmCompatCeilF32(f float32) float32
WasmCompatCeilF32 is the same as math.Ceil on 32-bit except that the returned NaN value follows the Wasm specification on NaN propagation. https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation
func WasmCompatCeilF64(f float64) float64
WasmCompatCeilF64 is the same as math.Ceil on 64-bit except that the returned NaN value follows the Wasm specification on NaN propagation. https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation
func WasmCompatFloorF32(f float32) float32
WasmCompatFloorF32 is the same as math.Floor on 32-bit except that the returned NaN value follows the Wasm specification on NaN propagation. https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation
func WasmCompatFloorF64(f float64) float64
WasmCompatFloorF64 is the same as math.Floor on 64-bit except that the returned NaN value follows the Wasm specification on NaN propagation. https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation
func WasmCompatMax32(x, y float32) float32
WasmCompatMax32 is the Wasm spec compatible variant of math.Max for 32-bit floating points.
func WasmCompatMax64(x, y float64) float64
WasmCompatMax64 is the Wasm spec compatible variant of math.Max for 64-bit floating points.
func WasmCompatMin32(x, y float32) float32
WasmCompatMin32 is the Wasm spec compatible variant of math.Min for 32-bit floating points.
func WasmCompatMin64(x, y float64) float64
WasmCompatMin64 is the Wasm spec compatible variant of math.Min for 64-bit floating points.
func WasmCompatNearestF32(f float32) float32
WasmCompatNearestF32 is the Wasm spec compatible variant of math.Round, used for Nearest instruction. For example, this converts 1.9 to 2.0, and this has the semantics of LLVM's rint intrinsic.
e.g. math.Round(-4.5) results in -5 while this results in -4.
See https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic.
func WasmCompatNearestF64(f float64) float64
WasmCompatNearestF64 is the Wasm spec compatible variant of math.Round, used for Nearest instruction. For example, this converts 1.9 to 2.0, and this has the semantics of LLVM's rint intrinsic.
e.g. math.Round(-4.5) results in -5 while this results in -4.
See https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic.
func WasmCompatTruncF32(f float32) float32
WasmCompatTruncF32 is the same as math.Trunc on 32-bit except that the returned NaN value follows the Wasm specification on NaN propagation. https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation
func WasmCompatTruncF64(f float64) float64
WasmCompatTruncF64 is the same as math.Trunc on 64-bit except that the returned NaN value follows the Wasm specification on NaN propagation. https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/exec/numerics.html#nan-propagation