0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} + re\right)}
(FPCore (re im) :precision binary64 (* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
double code(double re, double im) {
return 0.5 * sqrt(2.0 * (sqrt((re * re) + (im * im)) + re));
}
Please include this information when filing a bug report:
herbie shell --seed 2022118
(FPCore (re im)
:name "math.sqrt on complex, real part"
:precision binary64
:herbie-target
(if (< re 0.0) (* 0.5 (* (sqrt 2.0) (sqrt (/ (* im im) (- (sqrt (+ (* re re) (* im im))) re))))) (* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
(* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
| mpfr->C: argument is not non-null `mpfr' pointer argument: 0.0 | L | C | |
|---|---|---|---|
| bfzero? | /opt/racket-8.1/share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt | 797 | 4 |
| bigfloat->normal-string | /data/pavpan/nightlies/herbie/shortest-number/src/pretty-print.rkt | 6 | 0 |
| bigfloat-interval-shortest | /data/pavpan/nightlies/herbie/shortest-number/src/pretty-print.rkt | 100 | 0 |
| regimes-sidx->spoint | /data/pavpan/nightlies/herbie/shortest-number/src/core/regimes.rkt | 257 | 2 |
| sindices->spoints | /data/pavpan/nightlies/herbie/shortest-number/src/core/regimes.rkt | 216 | 0 |
| f54 | .../match/compiler.rkt | 540 | 40 |
| extract! | /data/pavpan/nightlies/herbie/shortest-number/src/mainloop.rkt | 394 | 0 |
| run-improve! | /data/pavpan/nightlies/herbie/shortest-number/src/mainloop.rkt | 326 | 0 |
| (unnamed) | /data/pavpan/nightlies/herbie/shortest-number/src/sandbox.rkt | 66 | 6 |
| (unnamed) | /opt/racket-8.1/share/pkgs/profile-lib/main.rkt | 40 | 10 |
| profile-thunk | /opt/racket-8.1/share/pkgs/profile-lib/main.rkt | 9 | 0 |
| (unnamed) | /opt/racket-8.1/collects/racket/engine.rkt | 42 | 24 |