Skip to content

mathjs/number does not accept "base" argument to log function #2514

@gwhitney

Description

@gwhitney

Discovered while working on #2506.
This code

import * as math from 'mathjs/number'
console.log(math.log(625,5))

does not display 4 as expected, but rather:

TypeError: Too many arguments in function logNumber (expected: 1, actual: 2)
    at createError (/home/glen/code/mathjs/node_modules/typed-function/typed-function.js:594:15)
    at Function._onMismatch (/home/glen/code/mathjs/node_modules/typed-function/typed-function.js:1118:13)
    at Function.generic (/home/glen/code/mathjs/node_modules/typed-function/typed-function.js:1077:22)
    at Module.logNumber (/home/glen/code/mathjs/node_modules/typed-function/typed-function.js:1092:24)
    at file:///home/glen/code/tstest/jtry.js:11:18
    at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  data: {
    category: 'tooManyArgs',
    fn: 'logNumber',
    index: 2,
    expectedLength: 1
  }
}

This is probably higher priority than the TypeScript definitions? Seems clearly a bug, as 625 and 5 are both numbers, so log(625, 5) seems like it should work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions