Repository navigation
Conversation
Motivation: MathModule.scala used lowercase "not a number" for NaN errors in std.sqrt, std.pow, std.asin, std.acos, std.log, std.log2, and std.log10, while the Evaluator and Val.Num already used uppercase "Not a number" / "Overflow". This created an inconsistency within sjsonnet itself and diverged from go-jsonnet's makeDoubleCheck convention. Modification: - MathModule.scala: capitalize "not a number" → "Not a number" in all 7 NaN error messages (sqrt, pow, asin, acos, log, log2, log10). - Update 6 golden files and StdMathTests.scala assertions. Result: Every numeric NaN error in sjsonnet now emits "Not a number" with consistent capitalization, matching go-jsonnet. Cross-implementation comparison: | Failure mode | sjsonnet (before) | sjsonnet (after) | go-jsonnet 0.22.0 | jrsonnet 0.5.0 | C++ jsonnet 0.22.0 | |---------------------------|--------------------|--------------------|--------------------|--------------------|--------------------| | std.pow(-1, 0.5) NaN | "not a number" | "Not a number" | "Not a number" | "non-finite" | "not a number" | | std.sqrt(-1) NaN | "not a number" | "Not a number" | "Not a number" | "out of bounds" | "not a number" | | std.asin(2) NaN | "not a number" | "Not a number" | "Not a number" | "non-finite" | "not a number" | | std.acos(2) NaN | "not a number" | "Not a number" | "Not a number" | "non-finite" | "not a number" | | std.log(-1) NaN | "not a number" | "Not a number" | "Not a number" | "non-finite" | "not a number" | | std.log2(-1) NaN | "not a number" | "Not a number" | "Not a number" | "non-finite" | "not a number" | | std.log10(-1) NaN | "not a number" | "Not a number" | "Not a number" | "non-finite" | "not a number" |
He-Pin
marked this pull request as draft
June 24, 2026 02:43
Contributor
Author
|
Let's just keep it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MathModule.scalafrom"not a number"to"Not a number"to match go-jsonnet'smakeDoubleCheckconventionVal.Numalready used uppercase, butstd.sqrt/std.pow/std.asin/std.acos/std.log/std.log2/std.log10used lowercaseStdMathTests.scalaassertionsCross-implementation comparison
std.pow(-1, 0.5)NaN"not a number""Not a number""Not a number""non-finite""not a number"std.sqrt(-1)NaN"not a number""Not a number""Not a number""out of bounds""not a number"std.asin(2)NaN"not a number""Not a number""Not a number""non-finite""not a number"std.acos(2)NaN"not a number""Not a number""Not a number""non-finite""not a number"std.log(-1)NaN"not a number""Not a number""Not a number""non-finite""not a number"std.log2(-1)NaN"not a number""Not a number""Not a number""non-finite""not a number"std.log10(-1)NaN"not a number""Not a number""Not a number""non-finite""not a number"Test plan
./mill sjsonnet.jvm[3.3.7].testpasses (33/33 tests)./mill sjsonnet.jvm[2.13.18].testpasses (8/8 tests)