small fixes

This commit is contained in:
2026-03-01 19:48:29 -04:00
parent 364facd9f0
commit 1764adf0a5
15 changed files with 68 additions and 24 deletions

View File

@@ -3,6 +3,7 @@
import { useState, useCallback } from "react";
import { Card } from "@/components/ui/card";
import { StepControls } from "./step-controls";
import { parseStrictDecimal } from "@/lib/math/validation";
type RoundTarget = "whole" | "1dp" | "2dp" | "1sf" | "2sf" | "3sf";
@@ -384,9 +385,9 @@ export function RoundingExplorer() {
function handleGo() {
setError("");
const trimmed = input.trim();
const val = parseFloat(trimmed);
if (isNaN(val)) {
setError("Enter a valid number.");
const val = parseStrictDecimal(trimmed);
if (val === null) {
setError("Enter a valid number (digits and decimal point only).");
return;
}
if (val < 0) {