mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
This is a sequel to #2531. Uniformizes the signatures of ceil, fix, floor, and round, and updates the TypeScript declarations to match. Adds the optional "number of places" argument to the chain versions of ceil, fix, and floor. Adds TypeScript tests for all rounding functions. Also corrects the TypeScript declaration for `bignumber()` and introduces a couple more common abbreviations for TypeScript types. Fixes the number-only implementations of floor, ceil, fix, and nthRoot to match the full implementation behavior on numbers, and tests this for floor. Includes some minor documentation updates and additional unit tests for the rounding functions. Reverts inclusion in AUTHORS of incorrect email for one contributor, that occurred in #2531. Resolves #2526. Resolves #2529.
8 lines
238 B
JavaScript
8 lines
238 B
JavaScript
const { e, floor, format, log, sqrt } = require('../../lib/cjs/number.js')
|
|
|
|
console.log(format(sqrt(4)))
|
|
console.log(format(sqrt(-4)))
|
|
console.log(format(log(e * e)))
|
|
console.log(format(log(625, 5)))
|
|
console.log(format(floor(7 - 1e-13)))
|