GithubHelp home page GithubHelp logo

sinful-math's People

Contributors

azure-pipelines[bot] avatar chipincode avatar nirmalgupta avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

sinful-math's Issues

Incorrect results of correctedValue() if product of arguments are too big

Weird bug: sub(30, 0.00004999999999833333) produces -0.0000499999999983333 for me.

sub( 9, 0.00004999999999833333) produces 8.999950000000002 which is more or less correct.

That long number has 20 digits to the right of the decimal place, which my NodeJS won't normally produce. Trimming a digit or two off the end of the number will return the right value.

I'm not sure what's going on; just thought I'd bring it up.

sinful.add(1e-7,1e-7) returns 0

adding small numbers return 0.
for example:
sinful.add(1e-7,1e-7) returns 0 instead of 2e-7.
However sinful.add(1e-6,1e-7) returns 0.000001

Looks like precision is set to 6. Is there a way to increase it to 9?

Small numbers result in an error

I have a number 7.471E-35 occurring in my code. When I use the add() function from this library it incorrectly rounds or truncates this to 0:

node
Welcome to Node.js v14.18.1.
Type ".help" for more information.
> const {add} = require('sinful-math');
undefined
> b = 4.761E-35
4.761e-35
> add(b,0)
0
> b+0
4.761e-35
> 
  • Result: 0
  • Expected result: 4.761e-35

Addition simply returning one value passed to function

I started using this lib to help with some floating point issues I was having on a currency conversion function. It's been reliable for some time but today, using on a different project, I got a problem with a simple addition operation. I first saw in the browser and have reproduced in node as in the screen grab below:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.