2169 Commits

Author SHA1 Message Date
Ayomide Bamigbade
6545dcd7c5
fix: #3597 added nullish type definitions (#3601) 2025-11-26 10:06:55 +01:00
Glen Whitney
7db791298c
fix: #3578 interpret empty true-expr of conditional as error (#3581) 2025-11-12 09:55:51 +01:00
Jos de Jong
b15904ff0b
fix: #3579 conditional parsed as optional chaining (#3584) 2025-11-05 12:21:55 +01:00
anslem chibuike
89ed9add18
fix: issues with the optional chaining operator: disallow double dot ?.., allow optional function calls, throw errors on invalid uses of ?. (#3585) 2025-11-05 09:39:46 +01:00
Jos de Jong
89cc54ae20
fix: #3562 serializing units (#3572) 2025-10-31 09:37:35 +01:00
Glen Whitney
8c659a86cd
fix: respect tolerances in function isInteger (#3575) 2025-10-31 09:10:07 +01:00
NilsDietrich
48ba6adbca
feat: support for optional chaining object?.key (#3547) 2025-10-29 11:07:52 +01:00
Glen Whitney
faf249b6c0
feature: add function bernoulli to calculate Bernoulli numbers (#3551) 2025-10-29 10:47:11 +01:00
Richard Taylor
92152117f5
Fix: don't throw exception when filter/map/forEach an empty array (#3567)
Removes out-of-bounds access to first element in optimizeCallback when
  the provided array/matrix is empty. Also adds numerous unit tests for such
  edge cases, and fixes a previously unreported internal bug in SparseMatrix,
  violating its own invariants on empty matrices.

  Resolves #3564.
---------

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2025-10-27 00:39:35 -07:00
Glen Whitney
9ee2a00877
feat: implement functions isFinite and isBounded (#3554) 2025-10-18 13:17:14 +02:00
Jos de Jong
8c783a9461 Merge branch 'develop' into v15
# Conflicts:
#	HISTORY.md
#	test/unit-tests/type/matrix/Index.test.js
2025-10-10 09:09:40 +02:00
David Contreras
5a8eb1064a
fix: #3541 throw an error when evaluating a range with a step of zero (#3548) 2025-10-10 08:31:41 +02:00
David Contreras
d303b34a7e
feat: improve the performance of map with multiple arguments (#3526) 2025-10-09 20:02:13 +02:00
Jos de Jong
302ed812e1
fix: #3529 change function size to always return an Array (#3535) 2025-10-09 10:33:15 +02:00
Jos de Jong
338dfe9ae3
fix: #3530 throw an error when trying to flatten a SparseMatrix (#3536) 2025-10-08 08:17:25 -07:00
Josh Kelley
4ec99fc022
fix: typos in code comments (#3544) 2025-10-01 11:50:17 +02:00
Josh Kelley
963476019a
fix: type definition of abs(complex) (#3543)
The absolute value of a complex number is a plain number.
2025-10-01 11:45:48 +02:00
Jos de Jong
f894645e4c chore: update unit tests 2025-09-24 11:28:18 +02:00
Jos de Jong
1e3c2a99aa Merge branch 'develop' into v15
# Conflicts:
#	HISTORY.md
2025-09-24 11:25:19 +02:00
Ikem
0b84ce264d
feat: add nullish coalescing operator support (#3497)
Resolves #3353.

* test: enhance nullish coalescing tests for arrays, matrices, and conditional expressions

* docs: add nullish coalescing operator precedence details and update syntax documentation
---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2025-09-17 19:49:15 -04:00
Jos de Jong
69b991fe54
fix: #3523 cleanup old polyfills from the browser bundle by removing core-js (#3524) 2025-09-05 10:21:32 +02:00
Jos de Jong
a4815d5bd2
feat: implement serialization support for Parser (fixes #3509) (#3525) 2025-09-05 10:18:05 +02:00
Jos de Jong
c7705cd17a chore: fix test:node not running *.test.cjs files 2025-09-03 10:55:10 +02:00
DongKwanKho
df8d098e82
fix: add missing type definition for function diff (#3520). Thanks @dodokw. 2025-09-02 11:00:18 +02:00
Jos de Jong
006274d9d0 fix: ignore some of the examples in doc.test.js (see #3519) 2025-08-28 16:03:21 +02:00
kyle-compute
aedbee550d
fix: #3512 sign of zero not returning zero in case of a fraction
* sign of zero fraction should return 0/1 instead of 1/1

* moved fraction zero test into correct fraction block

* moved fraction zero test into correct fraction block
2025-07-24 09:21:05 +02:00
David Contreras
10602fdbfd
feat: matrix subset according to type of input (#3485) 2025-07-16 10:40:13 +02:00
Jos de Jong
6b3b722140 chore: update unit test 2025-07-11 12:09:49 +02:00
Jos de Jong
311485f478 Merge remote-tracking branch 'origin/v15' into v15
# Conflicts:
#	AUTHORS
#	HISTORY.md
#	src/expression/parse.js
#	test/unit-tests/expression/parse.test.js
2025-07-11 11:54:30 +02:00
Jos de Jong
ba88f47be9
fix: #3421 require a space or delimiter after hex, bin, and oct values (#3463) 2025-07-11 11:47:13 +02:00
Jacopo Mercolini
8d19c8b51e
feat: toBest(unit, unitList, offset) function (#3484)
* feat: toBest tests

* feat: toBest function initial

* fix: tests and function changes

* fix: dependencies

* new way to handle

* updated tests

* test updated

* tests fixed

* cleaned useless tests

* cleaned useless condition

* fix: missing comments

* fix: moved tests

* other fix and clean

* change test to work with npx mocha "path" -g "toBest"

* deleted check large and small value

* deleted precision test and fix options to bestprefix

* fix: moved toBest tests in correct file

* fix: math create

* fix: aligned files pre-mr

* fix: toBest docs test

* fix: lint issues

* fix: comments

* fix: added a helper function to simplify the test readability

* fix: unit.md and units.md docs updated

* fix: test on units.length

* added post process denormalize for tobest function to string returned value

* removed this.clone into format

* feat improve incompatible units test

* fix assign prefixes

* fixed examples

* changed order of params of assertUnit

* fixed comments and added toBest in knowProblems at doc.test

* refactor: update toBest functionality and adjust related tests for accuracy

* refactor: remove unnecessary offset initialization in prefix application

---------

Co-authored-by: Luca Quercetti <l.quercetti@wecodeyou.it>
Co-authored-by: Elia Alesiani <elia.alesiani@gmail.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Co-authored-by: lucaQ <lucaquercetti@gmail.com>
Co-authored-by: EliaAlesiani <105418798+EliaAlesiani@users.noreply.github.com>
2025-07-09 19:16:47 +02:00
Glen Whitney
b44172bae9
fix: #3501 parse % as unary only when not followed by a term (#3505) 2025-07-04 16:26:25 +02:00
Glen Whitney
5655d71e06 Feat: Enhance Kronecker product to handle arbitrary dimension (#3461)
Previously `math.kron()` always returned a 2D matrix, and could not handle 3D or greater arrays. Now it always returns an array of the max dimension of its arguments.

Resolves #1753.
---------

Co-authored-by: Delaney Sylvans <delaneysylvans@gmail.com>
2025-07-03 13:35:46 -07:00
Kip Robinson
9aad1a043e feat: give unary % operator (percentage) higher precedence than binary % operator (modulus) (#3432) 2025-07-03 13:32:32 -07:00
mrft
09f6da9278
fix: #3493 #3499 #3494 type definitions of unit(number), for add and multiply without arguments, and for unit.to(unit) (#3495)
* fixes #3493 allowing math.unit(5), which would now fail because for values of MathNumericType and MathCollection, the second parameter wasn't optional

* Added tests, and as a result of that, fixed the definition of unit(value: MathCollection): Unit[] where no units seem to be allowed

* Changes as requested by josdejong

* math.add and math.multipl type fixes and added tests

* fixes #3494: math.unit(m).to(math.unit(cm)) is now ok for typescript
2025-07-02 10:37:44 +02:00
Jay Chang
d089378b77
fix: refine the type definitions of scope (#3490) 2025-06-11 17:17:24 +02:00
Jos de Jong
8e76654c7f Merge branch 'develop' into v15
# Conflicts:
#	AUTHORS
#	HISTORY.md
2025-06-04 10:45:11 +02:00
Don McCurdy
f3587d8634
fix #2199: parse non breaking white space &nbsp; as white space (#3487) 2025-06-04 09:42:37 +02:00
Rani D.
823d13e8f1
fix: #3469 add ResultSet interface and improve isResultSet typing (#3481)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-05-30 10:48:31 +02:00
Jos de Jong
943141893a fix: add embedded docs for the deprecated physical constant coulomb, see #3472 2025-05-29 10:13:43 +02:00
Delaney Sylvans
7a617b1ee2
fix: support multiplication of arrays with units (#3456) 2025-05-28 17:00:58 +02:00
Jos de Jong
123d4aac9d fix: #3472 rename physical constant coulomb to coulombConstant 2025-05-28 16:45:24 +02:00
Carl Osterwisch
bec75ed18a
fix: correctly parse (lbf in) (#3476) 2025-05-21 15:12:52 +02:00
David Contreras
920d0ca63c
feat: improve the performance of subset (#3467) 2025-05-21 10:09:30 +02:00
David Contreras
f9cb08d77e
feat: define embedded docs for compile, evaluate, parse, and parser, and add test for the examples in embedded docs (#3413) 2025-04-25 17:12:25 +02:00
Glen Whitney
72a2442c32
Feat: Enhance Kronecker product to handle arbitrary dimension (#3461)
Previously `math.kron()` always returned a 2D matrix, and could not handle 3D or greater arrays. Now it always returns an array of the max dimension of its arguments.

Resolves #1753.
---------

Co-authored-by: Delaney Sylvans <delaneysylvans@gmail.com>
2025-04-22 17:08:21 -07:00
Kip Robinson
4f748d22ec feat: give unary % operator (percentage) higher precedence than binary % operator (modulus) (#3432) 2025-04-22 15:59:02 -07:00
Jos de Jong
c3ee5ba397
fix: Use matching type for one when operating with valueless unit and a number (#3454)
Previously, when a valueless unit multiplied/divided something with a numerical value, it would just use ordinary 1 of type `number` in place of its null value. Now it matches the type of one used with the other numerical value.

Resolves #3450.
---------
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
2025-04-16 12:56:57 -07:00
Orel Ben Neriah
9a82b5c28e
feat: add LaTeX representation for fractions and corresponding tests (#3434) 2025-03-28 13:59:09 +01:00
aitee
b5773df3c0
fix: nthRoots latexFunctions template string (#3427) 2025-03-26 19:00:52 +01:00