josdejong/mathjs

[Document the] secant function messing up sec unit

Ouverte

#2 095 ouverte le 28 janv. 2021

 (4 commentaires) (0 réaction) (0 personne assignée)JavaScript (1 314 forks)batch import
documentationhelp wanted

Métriques du dépôt

Stars
 (15 065 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

I believe "sec" is a built-in alias for the time unit seconds. However, if I type "5 sec" into the https://mathnotepad.com (or the evaluate input on https://mathjs.org) the function sec seems to take precedence and throw a TypeError even though it is expecting a unit:

TypeError: Unexpected type of argument in function multiplyScalar (expected: number or Unit or string or boolean or BigNumber or Complex or Fraction, actual: function, index: 1)

Can we improve the parser to avoid this confusion? It seems the unit "sec" is currently unavailable.

Guide contributeur