Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
d97b552
tests(cbrt): add tests in cbrt.test.ts
nberlette Jan 14, 2026
f45811c
tests(log2): add tests in log2.test.ts
nberlette Jan 14, 2026
ff64da8
tests(log10): add tests in log10.test.ts
nberlette Jan 14, 2026
3a7af6f
tests(trunc): add tests in trunc.test.ts
nberlette Jan 14, 2026
34563ee
tests(ceil): add tests in ceil.test.ts
nberlette Jan 14, 2026
90d788b
tests(asin): add tests in asin.test.ts
nberlette Jan 14, 2026
19dfee0
tests(random): add tests in random.test.ts
nberlette Jan 14, 2026
42b1e64
tests(log): add tests in log.test.ts
nberlette Jan 14, 2026
a765059
tests(float32): add tests in float32/guards.test.ts
nberlette Jan 14, 2026
cd478d8
tests(float32): add tests in float32/constants.test.ts
nberlette Jan 14, 2026
19b928f
tests(float32): add tests in float32/index.test.ts
nberlette Jan 14, 2026
51a0297
tests(float32): add tests in float32/encode.test.ts
nberlette Jan 14, 2026
80f741f
tests(float32): add tests in float32/decode.test.ts
nberlette Jan 14, 2026
423dd03
tests(float32): add tests in float32/round.test.ts
nberlette Jan 14, 2026
3835bfc
tests(clamp): add tests in clamp.test.ts
nberlette Jan 14, 2026
112661c
tests(clz32): add tests in clz32.test.ts
nberlette Jan 14, 2026
bc9441d
tests(abs): add tests in abs.test.ts
nberlette Jan 14, 2026
95175de
tests(constants): add tests in constants/log2e.test.ts
nberlette Jan 14, 2026
de6fff9
tests(constants): add tests in constants/max_safe_integer.test.ts
nberlette Jan 14, 2026
9692166
tests(constants): add tests in constants/ln2.test.ts
nberlette Jan 14, 2026
423dbb9
tests(constants): add tests in constants/log10e.test.ts
nberlette Jan 14, 2026
b1788d5
tests(constants): add tests in constants/positive_zero.test.ts
nberlette Jan 14, 2026
9fe6267
tests(constants): add tests in constants/epsilon.test.ts
nberlette Jan 14, 2026
70429d5
tests(constants): add tests in constants/negative_zero.test.ts
nberlette Jan 14, 2026
e7ba4f8
tests(constants): add tests in constants/index.test.ts
nberlette Jan 14, 2026
0a86f5a
tests(constants): add tests in constants/nan.test.ts
nberlette Jan 14, 2026
702b8ce
tests(constants): add tests in constants/sqrt1_2.test.ts
nberlette Jan 14, 2026
1d2874a
tests(constants): add tests in constants/ln10.test.ts
nberlette Jan 14, 2026
de73d8f
tests(constants): add tests in constants/positive_infinity.test.ts
nberlette Jan 14, 2026
30e0ce6
tests(constants): add tests in constants/min_safe_integer.test.ts
nberlette Jan 14, 2026
b25afdb
tests(constants): add tests in constants/e.test.ts
nberlette Jan 14, 2026
2f1ec35
tests(constants): add tests in constants/max_value.test.ts
nberlette Jan 14, 2026
671ee01
tests(constants): add tests in constants/negative_infinity.test.ts
nberlette Jan 14, 2026
aa78c31
tests(constants): add tests in constants/pi.test.ts
nberlette Jan 14, 2026
e59164b
tests(constants): add tests in constants/sqrt2.test.ts
nberlette Jan 14, 2026
6339b2d
tests(constants): add tests in constants/infinity.test.ts
nberlette Jan 14, 2026
057b0ac
tests(constants): add tests in constants/min_value.test.ts
nberlette Jan 14, 2026
c4eabad
tests(expm1): add tests in expm1.test.ts
nberlette Jan 14, 2026
88c15b5
tests(sin): add tests in sin.test.ts
nberlette Jan 14, 2026
3227628
tests(constants): add tests in constants.test.ts
nberlette Jan 14, 2026
2afde59
tests(atan): add tests in atan.test.ts
nberlette Jan 14, 2026
c1ad7ec
tests(max): add tests in max.test.ts
nberlette Jan 14, 2026
414c082
tests(asinh): add tests in asinh.test.ts
nberlette Jan 14, 2026
2605942
tests(sinh): add tests in sinh.test.ts
nberlette Jan 14, 2026
4c19448
tests(index): add tests in index.test.ts
nberlette Jan 14, 2026
691a3dc
tests(acos): add tests in acos.test.ts
nberlette Jan 14, 2026
cf10a1c
tests(atan2): add tests in atan2.test.ts
nberlette Jan 14, 2026
7fa57d2
tests(guards): add tests in guards/positive_zero.test.ts
nberlette Jan 14, 2026
8414cdb
tests(guards): add tests in guards/safe_integer.test.ts
nberlette Jan 14, 2026
03ce7aa
tests(guards): add tests in guards/negative_zero.test.ts
nberlette Jan 14, 2026
c4b51a1
tests(guards): add tests in guards/index.test.ts
nberlette Jan 14, 2026
96d9254
tests(guards): add tests in guards/nan.test.ts
nberlette Jan 14, 2026
a32c1bb
tests(guards): add tests in guards/integer.test.ts
nberlette Jan 14, 2026
bea4c5c
tests(guards): add tests in guards/positive_infinity.test.ts
nberlette Jan 14, 2026
f4c48d9
tests(guards): add tests in guards/negative_infinity.test.ts
nberlette Jan 14, 2026
d8ad953
tests(guards): add tests in guards/infinity.test.ts
nberlette Jan 14, 2026
2f7a0d9
tests(guards): add tests in guards/finite.test.ts
nberlette Jan 14, 2026
bc54f3e
tests(tan): add tests in tan.test.ts
nberlette Jan 14, 2026
08aed8c
tests(ieee754): add tests in ieee754.test.ts
nberlette Jan 14, 2026
f251b51
tests(floor): add tests in floor.test.ts
nberlette Jan 14, 2026
151dc4f
tests(tanh): add tests in tanh.test.ts
nberlette Jan 14, 2026
a681e82
tests(imul): add tests in imul.test.ts
nberlette Jan 14, 2026
83de2cb
tests(float16): add tests in float16/guards.test.ts
nberlette Jan 14, 2026
113645b
tests(float16): add tests in float16/constants.test.ts
nberlette Jan 14, 2026
bff2bfa
tests(float16): add tests in float16/index.test.ts
nberlette Jan 14, 2026
034a367
tests(float16): add tests in float16/encode.test.ts
nberlette Jan 14, 2026
0d95931
tests(float16): add tests in float16/decode.test.ts
nberlette Jan 14, 2026
8fea689
tests(float16): add tests in float16/round.test.ts
nberlette Jan 14, 2026
111d253
tests(types): add tests in types/precision.test.ts
nberlette Jan 14, 2026
76bcb7d
tests(types): add tests in types/safe_integer.test.ts
nberlette Jan 14, 2026
2bd2971
tests(types): add tests in types/index.test.ts
nberlette Jan 14, 2026
97d1cd9
tests(types): add tests in types/integer.test.ts
nberlette Jan 14, 2026
9e8288f
tests(types): add tests in types/finite.test.ts
nberlette Jan 14, 2026
078fea9
tests(types): add tests in types/float.test.ts
nberlette Jan 14, 2026
a11be3f
tests(cos): add tests in cos.test.ts
nberlette Jan 14, 2026
4c856bf
tests(sqrt): add tests in sqrt.test.ts
nberlette Jan 14, 2026
745fdca
tests(atanh): add tests in atanh.test.ts
nberlette Jan 14, 2026
df5067c
tests(min): add tests in min.test.ts
nberlette Jan 14, 2026
61ec534
tests(pow): add tests in pow.test.ts
nberlette Jan 14, 2026
b63d225
tests(trigonometry): add tests in trigonometry.test.ts
nberlette Jan 14, 2026
c8801bf
tests(sign): add tests in sign.test.ts
nberlette Jan 14, 2026
da145a1
tests(exp): add tests in exp.test.ts
nberlette Jan 14, 2026
9e5bb65
tests(f16round): add tests in f16round.test.ts
nberlette Jan 14, 2026
d1f77d4
tests(log1p): add tests in log1p.test.ts
nberlette Jan 14, 2026
16c47f9
tests(round): add tests in round.test.ts
nberlette Jan 14, 2026
39c3a8e
tests(hypot): add tests in hypot.test.ts
nberlette Jan 14, 2026
bedc095
tests(cosh): add tests in cosh.test.ts
nberlette Jan 14, 2026
a7b5532
tests(fround): add tests in fround.test.ts
nberlette Jan 14, 2026
a8c6bb1
tests(acosh): add tests in acosh.test.ts
nberlette Jan 14, 2026
e64480e
tests(internal): create shared test helpers module
nberlette Jan 14, 2026
001eb18
chore(internal): add ArrayFrom to primordials
nberlette Jan 14, 2026
a91ded9
refactor(random): clean up MT19937 class, use ArrayFrom primordial
nberlette Jan 14, 2026
e828473
fix(float16,float32): use type-only imports for FloatFormat
nberlette Jan 14, 2026
3ee29e2
fix(ieee754): ensure floating point rounding logic is sound
nberlette Jan 14, 2026
b03dbd3
chore: update license
nberlette Jan 14, 2026
274186d
docs(readme): improve doctests, use node:assert
nberlette Jan 14, 2026
2e5c89d
config: rewrite CI workflow for npm trusted publishing
nberlette Jan 14, 2026
2c4e952
fix(constants): ensure negative-zero module is exported
nberlette Jan 14, 2026
4213810
tests: fix doctest error in src/index.ts
nberlette Jan 14, 2026
d8b588e
config: update deno.json tasks and settings
nberlette Jan 14, 2026
5c7d05e
fix(abs): ensure abs behaves like Math.abs
nberlette Jan 14, 2026
9603b7d
fix(asinh): ensure asinh behaves like Math.asinh
nberlette Jan 14, 2026
623e4fd
fix(atan): ensure atan behaves like Math.atan
nberlette Jan 14, 2026
567ce93
fix(atan2): ensure atan2 behaves like Math.atan2
nberlette Jan 14, 2026
4d8cbfc
fix(cbrt): ensure cbrt behaves like Math.cbrt
nberlette Jan 14, 2026
c3c3c27
fix(ceil): ensure ceil behaves like Math.ceil
nberlette Jan 14, 2026
a268b9e
fix(clz32): ensure clz32 behaves like Math.clz32
nberlette Jan 14, 2026
d57524b
fix(floor): ensure floor behaves like Math.floor
nberlette Jan 14, 2026
f0735a3
fix(hypot): ensure hypot behaves like Math.hypot
nberlette Jan 14, 2026
fb9e145
fix(min): ensure min behaves like Math.min
nberlette Jan 14, 2026
ede6803
fix(round): ensure round behaves like Math.round
nberlette Jan 14, 2026
079fc88
fix(sinh): ensure sinh behaves like Math.sinh
nberlette Jan 14, 2026
cf7b7f8
fix(sqrt): ensure sqrt behaves like Math.sqrt
nberlette Jan 14, 2026
1d8ba71
fix(trunc): ensure trunc behaves like Math.trunc
nberlette Jan 14, 2026
286227f
refactor(float16,float32)!: remove constants re-exports
nberlette Jan 14, 2026
7213f8d
ci: add build script
nberlette Jan 14, 2026
7c25f8e
ci: add coveralls integration to workflow
nberlette Jan 21, 2026
a73082a
chore: update gitignore
nberlette Jan 21, 2026
ecee653
tests: update readme doc tests, fix some coverage and typechecking is…
nberlette Jan 21, 2026
0fce7dc
chore: fmt
nberlette Jan 21, 2026
0ddc822
refactor(scripts): improve build script
nberlette Jan 22, 2026
f7b5472
refactor(atan2): remove unreachable code branches
nberlette Jan 22, 2026
888ba21
config: update exclusions for linting, testing, formatting
nberlette Jan 22, 2026
229ad1d
fix: lint errors
nberlette Jan 22, 2026
2336cee
fix(atanh): align behavior with native implementation
nberlette Jan 23, 2026
bb3e061
fix(log): ensure output matches Math.log
nberlette Jan 23, 2026
d066b07
docs(readme): improve testable examples in readme
nberlette Jan 23, 2026
cd01802
config: use deno task instead of deno run
nberlette Jan 23, 2026
ff5378a
chore: update .gitignore
nberlette Jan 23, 2026
32576b1
refactor(tests): move all .test.ts files into an isolated tests dir
nberlette Jan 24, 2026
904b5f4
fix(tests): update import paths for all test files
nberlette Jan 24, 2026
e3f2daa
chore: fmt
nberlette Jan 24, 2026
ccc8711
Merge pull request #15 from nberlette/refactor/isolate-tests
nberlette Jan 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 118 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,136 @@ on:
pull_request:
branches:
- main

workflow_dispatch:
inputs:
check:
type: boolean
description: "Run lint, fmt, and test?"
required: false
default: true
publish-jsr:
type: boolean
description: "Publish to JSR?"
required: false
default: false
publish-npm:
type: boolean
description: "Publish to NPM?"
required: false
default: false
publish-gpr:
type: boolean
description: "Publish to GPR?"
required: false
default: false
jobs:
check:
if: github.event.inputs.check == 'true' || github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- run: deno test -A --permit-no-files --parallel --no-check=remote
- run: deno fmt --check
- run: deno lint

- id: ok
run: deno task ok

- id: coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: .coverage/lcov.info

- id: coverage
uses: actions/upload-artifact@v6
with:
path: .coverage
name: nberlette-math-coverage_${{ github.ref_name }}-${{ github.sha }}
publish:
if: |
(github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/') &&
needs.check.result == 'success') ||
(github.event_name == 'workflow_dispatch' && (
github.event.inputs.publish-jsr == 'true' ||
github.event.inputs.publish-npm == 'true' ||
github.event.inputs.publish-gpr == 'true'
) && (needs.check.result == 'success' || github.event.inputs.check == 'false'))
runs-on: ubuntu-latest
needs: check
permissions:
contents: read
id-token: write
if: ((github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')))
packages: write
concurrency:
cancel-in-progress: true
group: publish-${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- run: npx jsr publish
- uses: actions/checkout@v6

- name: "setup deno"
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-jsr == 'true')
name: "publish to jsr"
run: deno publish

- if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-npm == 'true')
name: "setup node for npm"
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"

- id: build
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && (github.event.inputs.publish-npm == 'true' ||
github.event.inputs.publish-gpr == 'true'))
name: "build for npm"
run: deno task build
env:
NO_PUBLISH: 1

- id: artifact
if: steps.build.outcome == 'success'
uses: actions/upload-artifact@v6
with:
path: npm
name: nberlette-math-npm_${{ github.ref_name }}-${{ github.sha }}

- if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-npm == 'true')
name: "publish to npm"
run: npm publish --access public
working-directory: npm

- if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-gpr == 'true')
name: "setup node for gpr"
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://npm.pkg.github.com"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-gpr == 'true')
name: "publish to gpr"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: npm
run: npm publish --access public --registry https://npm.pkg.github.com
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Thumbs.db
.coverage
coverage
.cov
npm
!deno.lock
5 changes: 2 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
The MIT License (MIT)
# The MIT License (MIT)
Comment thread
nberlette marked this conversation as resolved.

Copyright © 2024+ Nicholas Berlette (https://github.com/nberlette). All rights
reserved.
Copyright (c) 2024-2026 Nicholas Berlette. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
Expand Down
Loading
Loading