sideleft: new tool: conversions

This commit is contained in:
end-4
2025-03-29 13:04:32 +01:00
parent f2943f766a
commit 4f5d4f802e
5 changed files with 207 additions and 0 deletions
@@ -1,4 +1,10 @@
export function clamp(x, min, max) {
return Math.min(Math.max(x, min), max);
}
export function truncateToPrecision(value, precision) {
const factor = Math.pow(10, precision);
const result = Math.round(value * factor) / factor;
return result;
}