Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web/lib/fmt.ts from govindbalki/oncodsl: direct link, hf CLI and curl.
- Browser
- Download file 604 Bytes
-
https://huggingface.co/spaces/govindbalki/oncodsl/resolve/main/web/lib/fmt.ts
- Command line
-
hf download hf://spaces/govindbalki/oncodsl/web/lib/fmt.ts
-
curl -L -o fmt.ts https://huggingface.co/spaces/govindbalki/oncodsl/resolve/main/web/lib/fmt.ts
604 Bytes
| /** | |
| * Format a fitness / score value. Returns "—" for null, undefined, NaN, | |
| * or +/-Infinity so the UI never throws on degenerate programs. | |
| */ | |
| export function fmtFit(x: number | null | undefined, digits = 2): string { | |
| if (typeof x === "number" && Number.isFinite(x)) return x.toFixed(digits); | |
| return "—"; | |
| } | |
| /** Numeric value to use for sort / colour when the raw fitness isn't | |
| * finite. Pushes degenerate programs to the bottom of any ranking. */ | |
| export function fitnessForOrder(x: number | null | undefined): number { | |
| return typeof x === "number" && Number.isFinite(x) ? x : -Infinity; | |
| } | |