Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imath::solveCubic returns wrong root #86

Closed
hulud75 opened this issue Feb 1, 2021 · 1 comment
Closed

Imath::solveCubic returns wrong root #86

hulud75 opened this issue Feb 1, 2021 · 1 comment

Comments

@hulud75
Copy link

hulud75 commented Feb 1, 2021

Hi there,

I suspect Imath::solveCubic to return wrong results in some configurations.

This test does not pass on master (commit 8916ff5) :

    double roots[3];
    const double a = 36.1182938;
    const double b = -37.4285049;
    const double c = 0.0;
    const double d = 12.6194038;
    const int n = Imath::solveCubic(a, b, c, d, roots); // n is 1
    const double t = roots[0];
    double x = t*t*t*a + t*t*b + t*c + d;
    assert(std::fabs(x) < 0.000001);  // x is 6.8453819766985458

Best,

Cyril

@cary-ilm
Copy link
Member

Closing, this should be resolved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants