raymon1 / financial

Financial is a Rust crate that contains collection of finance calculations memicking some of Excel Financial Functions interface.
https://docs.rs/crate/financial
14 stars 5 forks source link

irr() can produce non-optimal solutions #3

Closed kyegupov closed 2 years ago

kyegupov commented 2 years ago

test case:

    #[test]
    fn irr_finds_closest_root_to_zero() {
        let cf = [10., 20., -10.];
        let guess = Some(0.);
        assert_eq!(irr(&cf, guess).unwrap(), -0.5857864377789364); // fails: returns -3.414213531256609
    }