Skip to content

Commit 41d2db1

Browse files
authored
Merge branch 'develop' into broadcasting-functions
2 parents d593869 + 8fe12e5 commit 41d2db1

File tree

9 files changed

+761
-977
lines changed

9 files changed

+761
-977
lines changed

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Richard Taylor <richard.taylor@claconnect.com>
282282
NilsDietrich <61544566+NilsDietrich@users.noreply.github.com>
283283
anslem chibuike <144047596+AnslemHack@users.noreply.github.com>
284284
Ayomide Bamigbade <iamtryve@gmail.com>
285-
Dheemanth07 <dheemanth1007@gmail.com>
286285
Anadian <willanad@yandex.com>
286+
Dheemanth D <165369664+Dheemanth07@users.noreply.github.com>
287287

288288
# Generated by tools/update-authors.js

HISTORY.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# History
22

3-
# unreleased changes since 15.1.0
3+
# 2026-02-10, 15.1.1
44

55
- Fix: #3631 Handle bigints in `compareNatural` (#3632). Thanks @Dheemanth07.
6-
- Docs: Correct several arithmetic and relational documentation examples
7-
and add History (#3630). Thanks @Anadian.
86
- Fix: #3578 interpret empty true-expr of conditional as error (#3581).
97
Thanks @gwhitney.
108
- Fix: #3597 added nullish type definitions (#3601). Thanks @Ayo1984.
9+
- Docs: Correct several arithmetic and relational documentation examples
10+
and add History (#3630). Thanks @Anadian.
1111
- Docs: fix #3565, update Matrix documentation (#3591). Thanks @orelbn.
1212
- Docs: #3341 add per-function HISTORY sections (#3606). Thanks @gwhitney.
13+
- Docs: describe that `setDistinct` sorts the elements (see #3602).
1314

1415
# 2025-11-05, 15.1.0
1516

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ To see the coverage results, open the generated report in your browser:
191191

192192
### Continuous integration testing
193193

194-
Continuous integration tests are run on [GitHub Actions](https://github.com/josdejong/mathjs/actions) and [TestMu AI](https://www.testmu.ai) (formerly LambdaTest) every time a commit is pushed to GitHub. GitHub Actions runs the tests for different versions of node.js, and TestMu AI runs the tests on all major browsers.
194+
Continuous integration tests are run on [GitHub Actions](https://github.com/josdejong/mathjs/actions) and [TestMu AI](https://www.testmuai.com/?utm_medium=sponsor&utm_source=mathjs) (formerly LambdaTest) every time a commit is pushed to GitHub. GitHub Actions runs the tests for different versions of node.js, and TestMu AI runs the tests on all major browsers.
195195

196-
[![TestMu AI](https://raw.github.com/josdejong/mathjs/develop/misc/testmu-ai.svg)](https://www.testmu.ai)
196+
[![TestMu AI](https://raw.github.com/josdejong/mathjs/develop/misc/testmu-ai.svg)](https://www.testmuai.com/?utm_medium=sponsor&utm_source=mathjs)
197197

198198
Thanks, GitHub Actions and TestMu AI for the generous free hosting of this open source project!
199199

package-lock.json

Lines changed: 685 additions & 940 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mathjs",
3-
"version": "15.1.0",
3+
"version": "15.1.1",
44
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
55
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
66
"homepage": "https://mathjs.org",
@@ -36,23 +36,23 @@
3636
"typed-function": "^4.2.1"
3737
},
3838
"devDependencies": {
39-
"@babel/core": "7.28.5",
39+
"@babel/core": "7.29.0",
4040
"@babel/plugin-transform-object-assign": "7.27.1",
41-
"@babel/plugin-transform-optional-catch-binding": "7.27.1",
42-
"@babel/plugin-transform-runtime": "7.28.5",
43-
"@babel/preset-env": "7.28.5",
44-
"@babel/register": "7.28.3",
41+
"@babel/plugin-transform-optional-catch-binding": "7.28.6",
42+
"@babel/plugin-transform-runtime": "7.29.0",
43+
"@babel/preset-env": "7.29.0",
44+
"@babel/register": "7.28.6",
4545
"@types/assert": "1.5.11",
4646
"@types/mocha": "10.0.10",
47-
"@typescript-eslint/eslint-plugin": "8.46.3",
48-
"@typescript-eslint/parser": "8.46.3",
47+
"@typescript-eslint/eslint-plugin": "8.55.0",
48+
"@typescript-eslint/parser": "8.55.0",
4949
"assert": "2.1.0",
5050
"babel-loader": "10.0.0",
5151
"c8": "10.1.3",
5252
"codecov": "3.8.3",
5353
"del": "8.0.1",
5454
"eigen": "0.2.2",
55-
"es-check": "9.4.4",
55+
"es-check": "9.5.4",
5656
"eslint": "8.57.1",
5757
"eslint-config-prettier": "9.1.0",
5858
"eslint-config-standard": "17.1.0",
@@ -61,7 +61,7 @@
6161
"eslint-plugin-n": "16.6.2",
6262
"eslint-plugin-prettier": "5.5.4",
6363
"eslint-plugin-promise": "6.6.0",
64-
"expect-type": "1.2.2",
64+
"expect-type": "1.3.0",
6565
"expr-eval": "2.0.2",
6666
"fancy-log": "2.0.0",
6767
"glob": "11.0.3",
@@ -85,14 +85,14 @@
8585
"ndarray-ops": "1.2.2",
8686
"ndarray-pack": "1.2.1",
8787
"numericjs": "1.2.6",
88-
"prettier": "3.6.2",
88+
"prettier": "3.8.1",
8989
"process": "0.11.10",
90-
"sinon": "21.0.0",
90+
"sinon": "21.0.1",
9191
"sylvester": "0.0.21",
92-
"tinybench": "5.1.0",
92+
"tinybench": "6.0.0",
9393
"ts-node": "10.9.2",
9494
"typescript": "5.9.3",
95-
"webpack": "5.102.1",
95+
"webpack": "5.105.0",
9696
"zeros": "1.0.0"
9797
},
9898
"type": "module",

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const version = '15.1.0'
1+
export const version = '15.1.1'
22
// Note: This file is automatically generated when building math.js.
33
// Changes made in this file will be overwritten.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// test performance of plain JS functions vs custom functions defined via the expression parser
2+
3+
import assert from 'node:assert'
4+
import { Bench } from 'tinybench'
5+
import { all, create } from '../../lib/esm/index.js'
6+
import { formatTaskResult } from './utils/formatTaskResult.js'
7+
8+
const math = create(all)
9+
10+
const cubeJsPlain = (x) => x * x * x
11+
const cubeJsWithMathjsFn = (x) => math.multiply(x, math.multiply(x, x))
12+
const cubeMathjsCustomFn = math.evaluate('f(x) = x * x * x')
13+
14+
assert.strictEqual(cubeJsPlain(3), 27)
15+
assert.strictEqual(cubeJsWithMathjsFn(3), 27)
16+
assert.strictEqual(cubeMathjsCustomFn(3), 27)
17+
18+
const bench = new Bench({ time: 100, iterations: 1000 })
19+
.add('cubeJsPlain', function () {
20+
cubeJsPlain(3)
21+
})
22+
.add('cubeJsWithMathjsFn', function () {
23+
cubeJsWithMathjsFn(3)
24+
})
25+
.add('cubeMathjsCustomFn', function () {
26+
cubeMathjsCustomFn(3)
27+
})
28+
29+
bench.addEventListener('cycle', (event) => console.log(formatTaskResult(bench, event.task, 3)))
30+
await bench.run()

test/benchmark/utils/formatTaskResult.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ const varianceWidth = 8
55
* Format a result like "Task name 2.30 µs ±0.79%"
66
* @param {import('tinybench').Bench} bench
77
* @param {import('tinybench').Task} task
8+
* @param {number} [digits]
89
* @return {string}
910
*/
10-
export function formatTaskResult (bench, task) {
11+
export function formatTaskResult (bench, task, digits = 2) {
1112
const nameWidth = Math.max(...bench.tasks.map(task => task.name.length)) + 1
1213

1314
const name = task.name
1415
const { variance, mean } = task.result.latency
1516

16-
const meanStr = `${(mean * 1000).toFixed(2)} \u00b5s`
17+
const meanStr = `${(mean * 1000).toFixed(digits)} \u00b5s`
1718
const varianceStr = ${((variance / mean) * 100).toFixed(2)}%`
1819
return `${padRight(name, nameWidth)} ${padLeft(meanStr, durationWidth)} ${padLeft(varianceStr, varianceWidth)}`
1920
}

types/index.d.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ export interface NodeCtor {
178178
new (): MathNode
179179
}
180180

181-
export interface AccessorNode<TObject extends MathNode = MathNode>
182-
extends MathNode {
181+
export interface AccessorNode<
182+
TObject extends MathNode = MathNode
183+
> extends MathNode {
183184
type: 'AccessorNode'
184185
isAccessorNode: true
185186
object: TObject
@@ -195,8 +196,9 @@ export interface AccessorNodeCtor {
195196
): AccessorNode<TObject>
196197
}
197198

198-
export interface ArrayNode<TItems extends MathNode[] = MathNode[]>
199-
extends MathNode {
199+
export interface ArrayNode<
200+
TItems extends MathNode[] = MathNode[]
201+
> extends MathNode {
200202
type: 'ArrayNode'
201203
isArrayNode: true
202204
items: [...TItems]
@@ -207,8 +209,9 @@ export interface ArrayNodeCtor {
207209
): ArrayNode<TItems>
208210
}
209211

210-
export interface AssignmentNode<TValue extends MathNode = MathNode>
211-
extends MathNode {
212+
export interface AssignmentNode<
213+
TValue extends MathNode = MathNode
214+
> extends MathNode {
212215
type: 'AssignmentNode'
213216
isAssignmentNode: true
214217
object: SymbolNode | AccessorNode
@@ -295,8 +298,9 @@ export interface ConstantNodeCtor {
295298
): ConstantNode<TValue>
296299
}
297300

298-
export interface FunctionAssignmentNode<TExpr extends MathNode = MathNode>
299-
extends MathNode {
301+
export interface FunctionAssignmentNode<
302+
TExpr extends MathNode = MathNode
303+
> extends MathNode {
300304
type: 'FunctionAssignmentNode'
301305
isFunctionAssignmentNode: true
302306
name: string
@@ -329,8 +333,9 @@ export interface FunctionNodeCtor {
329333
onUndefinedFunction: (name: string) => any
330334
}
331335

332-
export interface IndexNode<TDims extends MathNode[] = MathNode[]>
333-
extends MathNode {
336+
export interface IndexNode<
337+
TDims extends MathNode[] = MathNode[]
338+
> extends MathNode {
334339
type: 'IndexNode'
335340
isIndexNode: true
336341
dimensions: [...TDims]
@@ -420,8 +425,9 @@ export interface OperatorNodeCtor extends MathNode {
420425
implicit?: boolean
421426
): OperatorNode<TOp, TFn, TArgs>
422427
}
423-
export interface ParenthesisNode<TContent extends MathNode = MathNode>
424-
extends MathNode {
428+
export interface ParenthesisNode<
429+
TContent extends MathNode = MathNode
430+
> extends MathNode {
425431
type: 'ParenthesisNode'
426432
isParenthesisNode: true
427433
content: TContent
@@ -453,8 +459,9 @@ export interface RangeNodeCtor {
453459
): RangeNode<TStart, TEnd, TStep>
454460
}
455461

456-
export interface RelationalNode<TParams extends MathNode[] = MathNode[]>
457-
extends MathNode {
462+
export interface RelationalNode<
463+
TParams extends MathNode[] = MathNode[]
464+
> extends MathNode {
458465
type: 'RelationalNode'
459466
isRelationalNode: true
460467
conditionals: string[]

0 commit comments

Comments
 (0)