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>
* 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
* 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>
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>
* 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
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>
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>