josdejong/mathjs

[Document the] secant function messing up sec unit

开放

#2,095 创建于 2021年1月28日

 (4 条评论) (0 个反应) (0 位负责人)JavaScript (1,314 个派生)batch import
documentationhelp wanted

仓库指标

星标
 (15,065 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南