Skip to content

Commit

Permalink
Merge pull request #3363 from quantified-uncertainty/formatting-fixes
Browse files Browse the repository at this point in the history
Quick fix for FormattedNumber
  • Loading branch information
OAGr authored Sep 6, 2024
2 parents 7376a70 + 347d5e9 commit f5c90f8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/llmRunner/src/app/api/create/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SquiggleResponse,
} from "../../utils/squiggleTypes";

export const maxDuration = 500;
export const maxDuration = 300;

export async function POST(req: Request) {
const abortController = new AbortController();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import {

describe("FormattedNumber", () => {
const makeTestCases: [number, ReturnType<typeof makeFormattedNumber>][] = [
[0.01, { type: "basic", value: "0.01", isNegative: false }],
[123.45, { type: "basic", value: "120", isNegative: false }],
[-123.45, { type: "basic", value: "120", isNegative: true }],
[1234, { type: "basic", value: "1200", isNegative: false }],
[1000, { type: "basic", value: "1000", isNegative: false }],
[
1234567,
{ type: "unit", mantissa: "1.2", symbol: "M", isNegative: false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe("compactTreeString", () => {
},
y: {
vType: "SampleSetDist",
samples: [10400, 6830, 5280, 7700, ...1000 total],
samples: [1.04e4, 6830, 5280, 7700, ...1000 total],
summary: {
mean: ...,
p5: ...,
Expand Down
2 changes: 1 addition & 1 deletion packages/squiggle-lang/src/utility/FormattedNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const makeFormattedNumber = (

const magnitude = calculateOrderOfMagnitude(absNumber);

if (magnitude > -2 && magnitude < 5) {
if (magnitude > -3 && magnitude < 4) {
return {
type: "basic",
value: formatNumberWithScale(absNumber, 0, precision),
Expand Down

0 comments on commit f5c90f8

Please sign in to comment.