The whole project lived under a redundant veritas/ subdirectory with only a stub README.md at the repo root, so GitHub showed caelum0x/veritas as veritas/<everything>. Move all files up to the root and drop the stub. History is preserved (git detects renames). Build unaffected: 0 type errors across packages + all 31 apps, 49 tests passing from the new root. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
18 lines
583 B
TypeScript
18 lines
583 B
TypeScript
// Standalone numeric clamping and rounding helpers.
|
|
|
|
/** Clamp `value` into [min, max]. */
|
|
export function clampNumber(value: number, min: number, max: number): number {
|
|
return Math.min(max, Math.max(min, value));
|
|
}
|
|
|
|
/** Round to a fixed number of decimal places. */
|
|
export function roundTo(value: number, decimals: number): number {
|
|
const f = 10 ** decimals;
|
|
return Math.round(value * f) / f;
|
|
}
|
|
|
|
/** True if two numbers are within `epsilon` of each other. */
|
|
export function approxEqual(a: number, b: number, epsilon = 1e-9): boolean {
|
|
return Math.abs(a - b) <= epsilon;
|
|
}
|