docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Utilities for processing scalar readings: normalization with rounding, integer division breakdown, trigonometric projection, and parity grouping for collections.
-12.345 with decimals = 2, returns { rounded: -12.35, magnitude: 12.345, sign: -1 } using half-up rounding and a non-negative integer decimals. @testNaN raises an error indicating the input is not a valid number. @testdividend = -17 and divisor = 5, returns quotient = -4 and remainder = 3 using floor-style integer division semantics, with a non-negative remainder smaller than the divisor magnitude. @testangleRadians = π/4, returns sine and cosine within 0.0001 of √2 / 2, and a unitLength within 0.001 of 1 computed from those components. @test[3, 4, 0, -2], returns even = [4, 0, -2] and odd = [3], preserving input order. @testexport interface NormalizedReading {
rounded: number;
magnitude: number;
sign: -1 | 0 | 1;
}
export interface DivisionBreakdown {
quotient: number;
remainder: number;
}
export interface WaveSnapshot {
sine: number;
cosine: number;
unitLength: number;
}
export interface ParityPartition {
even: number[];
odd: number[];
}
export function normalizeReading(value: number, decimals: number): NormalizedReading;
export function divisionBreakdown(dividend: number, divisor: number): DivisionBreakdown;
export function waveSnapshot(angleRadians: number): WaveSnapshot;
export function parityPartition(values: number[]): ParityPartition;Functional toolkit used for numeric primitives, integer division variants, rounding, trigonometry, NaN detection, and parity checks.