Skip to content

Add float classification APIs for vmath 3.1.0 - #90

Draft
treeform wants to merge 4 commits into
masterfrom
agent/vmath-3-1-float-classification
Draft

Add float classification APIs for vmath 3.1.0#90
treeform wants to merge 4 commits into
masterfrom
agent/vmath-3-1-float-classification

Conversation

@treeform

@treeform treeform commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep direct Boolean implementations of isNan, isInf, and isFinite
  • match std/math classification semantics without using FloatClass at runtime
  • test all predicates against std/math behavior
  • benchmark direct predicates against FloatClass-based classify checks
  • bump the package version to 3.1.0
  • document the isNan compatibility change and migration path

Breaking change

isNan previously treated infinity as NaN. It now matches standard-library semantics and returns true only for NaN. Callers that want to reject both NaN and infinity should replace isNan(x) with not isFinite(x).

Performance

Nim 2.2.10 does not provide dedicated isInf or isFinite predicates. Release benchmarks show the direct predicates are approximately 15-22x faster than using std/math.classify for these Boolean checks. vmath also keeps its small direct isNan predicate rather than re-exporting std/math.

Validation

  • all native and JavaScript test configurations
  • std/math semantic parity tests for float32 and float64
  • nim r -d:release tests/bench_isNan.nim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant