@univerjs/engine-formula v0.5.0-beta.1Docs


Function: strip()

function strip(num, precision): number

Complete the number to the specified accuracy and solve the accuracy error,

e.g. strip(0.30000000000000004,15) => 0.3

Why precision is 15?

Excel only saves 15 digits

reference: https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript

Parameters

ParameterTypeDefault value
numnumberundefined
precisionnumber15

Returns

number

Defined in

submodules/univer/packages/engine-formula/src/engine/utils/math-kit.ts:190