Function: subtract()
ts
function subtract(a, b): number;Subtracts second number from first number with fixed precision. 高精度减法运算,避免浮点数误差。
Parameters
| Parameter | Type | Description |
|---|---|---|
a | number | The minuend / 被减数 |
b | number | The subtrahend / 减数 |
Returns
number
The result of subtracting b from a / 减法结果
Example
typescript
subtract(0.3, 0.1) // => 0.2 (not 0.19999999999999998)
subtract(123.456, 23.45) // => 100.006Since
1.0.0