2024 Commits

Author SHA1 Message Date
Jos de Jong
c118eaec90 fix: #3232 fix type definitions of function format to support notations hex, bin, and oct 2024-07-11 13:12:27 +02:00
Adam Jones
1db2ba6d3b
Further improve quantileSeq typings (#3223)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-06-28 12:15:09 +02:00
Orel Ben Neriah
3f6567a231
fix: #2348 update type definitions of the Parser methods (#3226)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-06-28 11:49:53 +02:00
David Contreras
5785cb95f1
Broadcast refactor (#3220) 2024-06-19 18:51:37 +02:00
Lucas Eng
eb35274447
chore: add unit tests for deepMap, isCollection, and reduce 2024-06-03 20:12:36 +02:00
Jos de Jong
fe4667cd8f Merge branch 'refs/heads/develop' into v13
# Conflicts:
#	AUTHORS
#	package-lock.json
2024-05-31 14:09:56 +02:00
Jos de Jong
ab3461d484
feat: implement support for bigint (#3207, #2737) 2024-05-31 12:43:09 +02:00
Lucas Eng
e8b1e0d293
chore: added test cases to deepForEach (#3211) 2024-05-30 17:04:49 +02:00
Jos de Jong
1f05a35d68
chore: convert CJS files to ESM (#3204) 2024-05-22 08:46:14 +02:00
Jos de Jong
f5755e71dc Merge branch 'refs/heads/develop' into v13 2024-05-21 16:09:28 +02:00
Adam Jones
ffa3a2e20a
Improve quantileSeq typings (#3198)
* Improve quantileSeq typings

* Add tests, revert comment changes

* Fix type tests
2024-05-16 08:47:13 +02:00
Jos de Jong
31b68ced13 chore: adjust isPositive, isNegative, and isZero to the new relTol and absTol 2024-05-15 11:12:19 +02:00
Jos de Jong
95a8c9477c chore: move sinon to devDependencies and fix two typos 2024-05-15 11:06:26 +02:00
David Contreras
eded7e1dc3
feat: nearly equal with relative and absolute tolerance (#3152)
* nearlyEqual with absolute and relative tolerances

* Format

* nearlyEqual for bigNumber

* Added skip for NaN

* Reduce diff a bit

* Issue with examples in jsdcos

* Updated all calls for nearlyEqual

* Fixed failing tests

* Changed epsilon to relTol, absTol

* Changed references to epsilon in docs and tests

* Added warning for config.epsilon

* Fix warning in zeta.test

* Added config test

* Added sinon to test console.warn

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-05-15 10:56:11 +02:00
Jos de Jong
5ee9f6f8d6 Merge branch 'refs/heads/develop' into v13 2024-05-15 10:51:15 +02:00
Jos de Jong
da0c70ebe3 fix: serialization of Units without a value, see #1240 2024-04-29 10:40:57 +02:00
Jos de Jong
d97f338fcc chore: replace util functions values and contains and usages of indexOf with using native JS functions values and contains (see #3194) 2024-04-25 08:35:49 +02:00
Laurent Gérin
81d2e71445
fix #3192: function isNaN returns false for NaN units in a matrix or array
* Use referToSelf() to recursively check if various types are NaN in an array or matrix

* fix array test description from isNegative to isNaN

* Add test for units in a matrix

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-04-24 09:31:06 +02:00
Jos de Jong
2e427ec3a9 fix: #3180 fix type definitions of function add and multiply to allow
more than two arguments
2024-04-03 09:27:12 +02:00
Jos de Jong
becae3775f fix: #3175 cannot delete units using math.Unit.deleteUnit 2024-03-13 16:35:52 +01:00
Jos de Jong
a41def8360 fix: #3172 simplify "true and true" 2024-03-13 14:25:56 +01:00
Jos de Jong
50b15a751d fix #3163: toTex wrongly returning Infinity for large BigNumbers 2024-02-23 11:20:17 +01:00
Jos de Jong
f37d4154ad Merge branch 'develop' into v13 2024-02-22 17:19:48 +01:00
Jos de Jong
f504ffe1d3 chore: update devDependencies (most notably eslint) 2024-02-22 16:27:24 +01:00
Brian Fugate
85b65da6cb
Fix: #3100 function round not handling round-off errors (#3136)
* Fixing rounding bug from issue 3100

* Corrected syntax and converted if...else to logic using ternary operator

* Removing nearlyEqual comparison because a false
return value was mathematically impossible by
user input.

Adding dynamic epsilon logic to cover cases when
a user requests to round a number to a higher
precision than epsilon in the config file.

Also adding tests to cover dynamic epsilon cases.

* Removing dynamic epsilon and adding test for changing config.epsilon during runtime

* Reintroducing nearly equal verification for
round function.

Adding test case for changing epsilon at runtime.

Both tests for changing epsilon at runtime also
verify the false nearlyEqual scenario.

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-02-22 16:17:05 +01:00
Rich Martinez
b78ac811a4
fix: mode signature return types (#3153)
* fix: mode type signatures

* Add ts tests for mode

* Add assertions mode type tests

* Update author Rich in AUTHORS file

---------

Co-authored-by: Rich Martinez <richmartinez@Edinas-MacBook-Pro.local>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-02-21 12:36:40 +01:00
Jos de Jong
663bbea40d fix: linting issue 2024-02-21 12:23:05 +01:00
Jos de Jong
a7f84abe51 fix: PartitionedMap and ObjectWrappingMap missing a property
`Symbol.iterator`
2024-02-21 12:17:30 +01:00
David Contreras
065b3ae4e8
feat: trailing commas in matrices (#3154) 2024-02-15 13:35:19 +01:00
David Contreras
e1817baa0b
Determinant with small numbers fix (#3139) 2024-02-14 17:49:07 +01:00
Jos de Jong
5a4f60fdf6
Fix not being able to use and and or inside a function definition (#3150)
* chore: write unit tests using `and` and `or` inside a function definition (WIP)

* fix: #3143 fix scope issues in rawArgs functions by implementing a `PartitionedMap`

* fix: add more unit tests for `ObjectWrappingMap`

* fix: don't let `ObjectWrappingMap` and `PartitionedMap` extend `Map` (risk of having non-overwritten methods)

* docs: update docs about `rawArgs` functions
2024-02-08 09:53:21 +01:00
Jos de Jong
2fc796063a chore: fix linting issue 2024-02-08 09:21:42 +01:00
Jos de Jong
7d2497cc63 chore: add a benchmark to get a feel for how fast scope variables are resolved 2024-02-08 09:20:43 +01:00
Jos de Jong
a9dd8e7d5c fix: #3141 help(config) altering the actual config when evaluating the examples 2024-02-01 11:09:02 +01:00
Jos de Jong
c60f637a60 fix: #3142 support BigNumber values for the options of function format: precision, wordSize, lowerExp, upperExp 2024-01-31 10:58:42 +01:00
Jos de Jong
30d2738296 chore: do not output documentation warnings unless running with a --debug-docs flag 2024-01-17 14:11:41 +01:00
S.Y. Lee
e80681301a
Infer types of arguments more precisely (#3123)
* Prefer inferring types of nodes as tuples

* Implement for IndexNode

* Test for types

* Use tuple type for array node

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-01-15 09:43:28 +01:00
Carl Osterwisch
211d1b7041
fix toSI() wrongly converting degC (#3118)
* Add new test for degC toSI

* Convert value using to() if needed

* Only set ret.value = null when it is not already null

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-01-12 11:07:15 +01:00
Carl Osterwisch
f89e3cbbff
Unitless quantity conversion bug (#3117)
* Add test for conversion to unitless quantity

* Avoid access to missing array index

* Also check that other.units is not empty

* Add test for abs of dimensionless unit

* Fix: avoid access to missing units array index

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-01-10 17:53:18 +01:00
Alex Edgcomb
af55b125a2
Support new metric prefixes: Q, R, r, and q (#3113)
* added Q, R, r, q metrix prefixes

* tests added for new prefixes

* removed duplicate tests

* maybe square and cubic tests will bump code cov into the positive

* Check numeric value

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-01-10 17:29:52 +01:00
Jos de Jong
a6cc8e7128 fix: #3109 method Node.toHTML not accepting a custom handler 2023-12-20 12:37:34 +01:00
Jos de Jong
7e9ff612a0
feat: lazy evaluation of and, or, &, | (#3101, #3090)
* If fn has rawArgs set, pass unevaluated args

* Add shared helper function for evaluating truthiness

* Add and & or transform functions for lazy evaluation

* Add lazy evaluation of bitwise & and | operators

* Add unit tests for lazy evaluation

* Add lazy evaluation note to docs

* Move documentation to Syntax page

* Replace `testCondition()` with test evaluation
of logical function itself

* Use `isCollection()` to simplify bitwise transform functions

* fix: do not copy scope in raw OperatorNode, test lazy operators scope

* fix: linting issues

---------

Co-authored-by: Brooks Smith <brooks.smith@clearcalcs.com>
2023-12-08 16:17:44 +01:00
Jos de Jong
b9346720d6
feat: extend function round with support for units (#3095)
* fix #2761: implement support for units in function `round` (WIP)

* fix #2761: extend function `round` with support for units

* docs: describe all signatures in the docs of function round

* chore: fix linting issue

* chore: remove less-useful signatures for round with units and matrices
2023-11-17 10:15:17 +01:00
Jos de Jong
a1f3b7c6bf fix #3094: function derivative mutates the input expression when it fails 2023-11-15 12:39:04 +01:00
Jos de Jong
3d84b5b594 fix #3092: a typo in an error message when converting a string into a number 2023-11-09 09:25:43 +01:00
Jos de Jong
8679c07617 fix #3087: extend function mod with support for negative divisors in when using BigNumber or Fraction 2023-11-08 11:29:48 +01:00
Jos de Jong
544b86f25f
fix: #2919 TypeScript types not working with NodeNext module resolution (#3079) 2023-10-26 11:39:44 +02:00
Jos de Jong
3030c6b23f Merge branch 'develop' into v12
# Conflicts:
#	HISTORY.md
2023-10-26 10:50:07 +02:00
Jos de Jong
843a5fd550 chore: make the unit test more robust 2023-10-25 14:29:14 +02:00
Jos de Jong
0222ff7aa9 fix: function clone not throwing an error in case of an unsupported type like a function 2023-10-25 14:25:05 +02:00