or run

npx @tessl/cli init
Log in

Version

Files

docs

function-utilities.mdindex.mdlist-operations.mdmathematical-operations.mdobject-operations.mdstring-processing.md
tile.json

task.mdevals/scenario-9/

Numeric Reading Toolkit

Utilities for processing scalar readings: normalization with rounding, integer division breakdown, trigonometric projection, and parity grouping for collections.

Capabilities

Normalize reading

  • Given -12.345 with decimals = 2, returns { rounded: -12.35, magnitude: 12.345, sign: -1 } using half-up rounding and a non-negative integer decimals. @test
  • Passing NaN raises an error indicating the input is not a valid number. @test

Division breakdown

  • For dividend = -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. @test

Wave snapshot

  • For angleRadians = π/4, returns sine and cosine within 0.0001 of √2 / 2, and a unitLength within 0.001 of 1 computed from those components. @test

Parity partition

  • Given [3, 4, 0, -2], returns even = [4, 0, -2] and odd = [3], preserving input order. @test

Implementation

@generates

API

export 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;

Dependencies { .dependencies }

prelude.ls { .dependency }

Functional toolkit used for numeric primitives, integer division variants, rounding, trigonometry, NaN detection, and parity checks.