Giter VIP home page Giter VIP logo

num-bigfloat's People

Contributors

ludrol avatar stencillogic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

num-bigfloat's Issues

Bigfloat panics when result of division is < 1

While using the num-bigloat crate, we were hitting a panic mentioning that thread 'main' panicked at 'attempt to add with overflow'

After some investigation, we noticed that any operation that results in a value where the result is -1 > x < 1, panics.

For example, the code snippet below results in a panic.

use num_bigfloat::BigFloat;

fn main() {
    let x = BigFloat::from(1);
    let y = BigFloat::from(2);
    let z = x / y;
    println!("{z:?}");
}

problem with minus zero not equal to zero

assert!(BigFloat::from(-1).frac() == BigFloat::from(0))
is not equal to true

-0 is not equal to 0

Is this a bug?

some code for debugging

    let a = BigFloat::from(-1).frac();  
    let b = BigFloat::from(0);  
    assert!(a==b);

Running into an issue for parsing a really long string.

In the following situation:

        println!("input: {}", input);
        let val = match BigFloat::parse(input) {
            Some(s) => s,
            None => return None,
        };
        println!("val: {}", val.to_string());

The following are being treated as though they are identical:

input: 100000000000000000000000000000000000000000000.00000000000000000000000000000000000000001
val: 1.000000000000000000000000000000000000000e+39
input: 100000000000000000000000000000000000000000000.00000000000000000000000000000000000000002
val: 1.000000000000000000000000000000000000000e+39

When I compare them using .cmp() it returns 0.

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.