Skip to content

To fix the error of the operator not preserving decimal places 修正运算符小数位的错误

Notifications You must be signed in to change notification settings

xiahouwei/naive-compute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

naive-compute

To fix the error of the operator not preserving decimal places

修正运算符小数位的错误

install

npm install naive-compute

import and use

import compute from 'naive-compute'


console.log(33.33333, '*', 100000) // 3333332.9999999995 damn it !  (`Д´*)9

console.log(compute(33.33333, '*', 100000).result) // 3333333 got it! ╮( ̄▽ ̄)╭

console.log(compute(1024, '+', 1).compute('-', 1).compute('*', 1).compute('/', 1).result) // 1024 ╮( ̄▽ ̄)╭

About

To fix the error of the operator not preserving decimal places 修正运算符小数位的错误

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published