
(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)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * sqrt((2.0d0 * (sqrt(((re * re) + (im * im))) + re)))
end function
public static double code(double re, double im) {
return 0.5 * Math.sqrt((2.0 * (Math.sqrt(((re * re) + (im * im))) + re)));
}
def code(re, im): return 0.5 * math.sqrt((2.0 * (math.sqrt(((re * re) + (im * im))) + re)))
function code(re, im) return Float64(0.5 * sqrt(Float64(2.0 * Float64(sqrt(Float64(Float64(re * re) + Float64(im * im))) + re)))) end
function tmp = code(re, im) tmp = 0.5 * sqrt((2.0 * (sqrt(((re * re) + (im * im))) + re))); end
code[re_, im_] := N[(0.5 * N[Sqrt[N[(2.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} + re\right)}
\end{array}
herbie shell --seed 2024159 -o setup:simplify
(FPCore (re im)
:name "math.sqrt on complex, real part"
:precision binary64
:alt
(! :herbie-platform default (if (< re 0) (* 1/2 (* (sqrt 2) (sqrt (/ (* im im) (- (modulus re im) re))))) (* 1/2 (sqrt (* 2 (+ (modulus re im) re))))))
(* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
Please file a bug report with this information.
| operator-info: Unknown operator modulus | L | C | |
|---|---|---|---|
| (unnamed) | /home/nightlies/herbie/artem-baseline-vs-tuning-with-precondition/src/syntax/syntax.rkt | 294 | 2 |
| f432 | .../match/compiler.rkt | 559 | 40 |
| f432 | .../match/compiler.rkt | 559 | 40 |
| f432 | .../match/compiler.rkt | 559 | 40 |
| f432 | .../match/compiler.rkt | 559 | 40 |
| f432 | .../match/compiler.rkt | 559 | 40 |
| f432 | .../match/compiler.rkt | 559 | 40 |
| loop | /home/nightlies/herbie/artem-baseline-vs-tuning-with-precondition/src/syntax/sugar.rkt | 162 | 4 |
| fpcore->prog | /home/nightlies/herbie/artem-baseline-vs-tuning-with-precondition/src/syntax/sugar.rkt | 160 | 0 |
| get-alternatives/report | /home/nightlies/herbie/artem-baseline-vs-tuning-with-precondition/src/sandbox.rkt | 171 | 0 |
| (unnamed) | /home/nightlies/herbie/artem-baseline-vs-tuning-with-precondition/src/sandbox.rkt | 265 | 6 |
| (unnamed) | /usr/local/racket/share/pkgs/profile-lib/main.rkt | 40 | 10 |
| profile-thunk | /usr/local/racket/share/pkgs/profile-lib/main.rkt | 9 | 0 |
| (unnamed) | /usr/local/racket/collects/racket/engine.rkt | 42 | 24 |