Function: add()
ts
function add(a, b): number;Adds two numbers with fixed precision to avoid floating point errors. 高精度加法运算,避免浮点数误差。
Parameters
| Parameter | Type | Description |
|---|---|---|
a | number | The first number to add / 第一个加数 |
b | number | The second number to add / 第二个加数 |
Returns
number
The result of adding the two numbers / 加法结果
Example
typescript
add(0.1, 0.2) // => 0.3 (not 0.30000000000000004)
add(123.456, 78.9) // => 202.356Since
1.0.0