Incorporating unit offsets into the internal "value" of the unit
causes more problems than it solves. This commit ends that practice
and instead only uses the offset when converting units or when
computing the absolute value of a unit.
Further, it makes it an error to compute the sign of a unit with an
offset, since that is inherently ambiguous: there is no way to tell
whether "-5 degC" is a temperature change, in which case it is definitely
negative, or if it is a specific temperature of something, in which case
it is "positive" in the sense of being above absolute zero.
(Unclear how valuable this latter concept is anyway, given that there are
no negative temperatures possible in that sense...)
Adds several tests for the various problems the former practice caused,
including all four basic arithmetic operations on units with offsets.
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Also adds tests for math.log() of complex numbers in which the imaginary
part is much larger in absolute value than the real part.
Resolves#2503.
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* fix toTex(): remove row delimiter on the last row
* remove row delimiter on the last row (use map and join instead of forEach)
* fix ArrayNode.toTex() unit tests incorrectly expecting a row delimiter on the last row
* added toTex() tests for nested cases
* fixed ArrayNode.toTex() for nested cases
* removed redunant variable
* changed BigNumber to a class that extends Decimal.clone(...)
* it works... if you patch decimal.js
* added a test that checks if sum of Decimals works
* minor improvement of code quality
* updated Decimal.js to 10.3
* removed the optional chaining operator to keep compat w/ Node 12
* removed try/catch from isBigNumber
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* Add `.js` extension to source file imports
* Specify package `exports` in `package.json`
Specify package type as `commonjs` (It's good to be specific)
* Move all compiled scripts into `lib` directory
Remove ./number.js (You can use the compiled ones in `./lib/*`)
Tell node that the `esm` directory is type `module` and enable tree shaking.
Remove unused files from packages `files` property
* Allow importing of package.json
* Make library ESM first
* - Fix merge conflicts
- Refactor `bundleAny` into `defaultInstance.js` and `browserBundle.cjs`
- Refactor unit tests to be able to run with plain nodejs (no transpiling)
- Fix browser examples
* Fix browser and browserstack tests
* Fix running unit tests on Node 10 (which has no support for modules)
* Fix node.js examples (those are still commonjs)
* Remove the need for `browserBundle.cjs`
* Generate minified bundle only
* [Security] Bump node-fetch from 2.6.0 to 2.6.1 (#1963)
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. **This update includes a security fix.**
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* Cleanup console.log
* Add integration tests to test the entry points (commonjs/esm, full/number only)
* Create backward compatibility error messages in the files moved/removed since v8
* Describe breaking changes in HISTORY.md
* Bump karma from 5.2.1 to 5.2.2 (#1965)
Bumps [karma](https://github.com/karma-runner/karma) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v5.2.1...v5.2.2)
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Lee Langley-Rees <lee@greenimp.co.uk>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* feat: implementing norm 2 for matrices
* norm2: adding edge test cases
* norm2: adding edge test cases
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* make dot product faster and correct for ℂ
* minor fixes
* added tests, fixed bugs
* add dot for sparse matrices
* make multiply(vec, vec) use dot
* add test for complex vectors
* added test for mul(vec, vec), removed one TODO comment
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* fix qr and sign edge cases
qr() was throwing an error if the pivots of a matrix were zero.
This commit fixes that and ensures that the results are consistant
with wolfram alpha.
Whilst doing this I found a bug in complex.js, I have added a work
around but we should flag this upstream.
I also addressed the long standing concerns about assert statements
within the body of the qr function.
Fixes#1669Fixes#942
* further improvements to qr and sign
mainly fixing things I got wrong in previous commit
* add array test
* fix: remove only from tests and disallow
Uses mochas `--forbid-only` flag as advised by
https://github.com/standard/standard/issues/988