* 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>
* 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
* fix: infer the correct type from two arrays defined as 2D
* chore: add check that 1D * 1D (number[]) arrays result in scalar
* chore: remove commented out line
* fix: update test so that 2D arrays can be multiplied correctly
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* chore: Rename `apply` to `mapSlices`
This renaming conforms with the Julia name for the function formerly
called `apply`, and allows it to be called from the expression parser.
The previous name `apply` is kept as an alias for `mapSlices`, for
backward compatibility. This commit implements an `alias` metadata
property for function factories to facilitate the `apply` alias for
`mapSlices`.
As a separate bonus, this PR corrects several typos in function docs
and removes now-passing doc tests from the list of "known failing" doc
tests to get down to 45 known failures and 136 total issues in doc tests.
(Most of the excess of 136 as compared to 45 are just due to roundoff
error/slight inaccuracy of what the documentation claims the result will
be and the actual result returned by mathjs. When the 45 are eliminated,
a reasonable numeric tolerance can be decided on for doc testing and
then the doc tests can be made binding rather than advisory.
* refactor: changes per PR review
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Addressed silentmissile's comment in https://github.com/josdejong/mathjs/issues/3125
* Added method overload to index.d.ts, have to revert commit due to changes to package-lock.json with using npm install to run the unit tests & lint tests
* Type definition missing for matrixFrom* #3115
* fix: Update types and add tests as requested by review
* chore: lint fix
---------
Co-authored-by: Hudsxn <jhudson98new@gmail.com>
Co-authored-by: Hudsxn <143907857+Hudsxn@users.noreply.github.com>
BREAKING CHANGE:
The matrix types now support generics. For most practical cases, this doesn't cause a breaking change, but it is possible that it breaks typings in some specific edge cases.
* feat: export util functions `isMap`, `isPartitionedMap`, and `isObjectWrappingMap` and improve the documentation of `scope` (see #3150)
* chore: fix broken unit tests
* docs: refine the explanation about scopes
* fix: types static method for Unit class
Changes unit interface to declare class to enable the adding of static methods.
* refactor: change to not using declare class
* fix: adds more unit static methods and updates tests
* chore: moves test from wrong location
* fix: adds additional static methods and updates jsDocs
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* 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>
* 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>
* Addressed silentmissile's comment in https://github.com/josdejong/mathjs/issues/3125
* Added method overload to index.d.ts, have to revert commit due to changes to package-lock.json with using npm install to run the unit tests & lint tests
* 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>