mathjs/test/node-tests/commonjsAppNumberOnly.cjs
Glen Whitney 82074e85e0
fix: Type declarations for rounding functions (#2539)
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.
2022-04-25 12:07:02 +02:00

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