
(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}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (re im) :precision binary64 (if (<= (- (sqrt (+ (* re re) (* im im))) re) 0.0) (* im (* 0.5 (pow re -0.5))) (sqrt (* 0.5 (- (hypot im re) re)))))
double code(double re, double im) {
double tmp;
if ((sqrt(((re * re) + (im * im))) - re) <= 0.0) {
tmp = im * (0.5 * pow(re, -0.5));
} else {
tmp = sqrt((0.5 * (hypot(im, re) - re)));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if ((Math.sqrt(((re * re) + (im * im))) - re) <= 0.0) {
tmp = im * (0.5 * Math.pow(re, -0.5));
} else {
tmp = Math.sqrt((0.5 * (Math.hypot(im, re) - re)));
}
return tmp;
}
def code(re, im): tmp = 0 if (math.sqrt(((re * re) + (im * im))) - re) <= 0.0: tmp = im * (0.5 * math.pow(re, -0.5)) else: tmp = math.sqrt((0.5 * (math.hypot(im, re) - re))) return tmp
function code(re, im) tmp = 0.0 if (Float64(sqrt(Float64(Float64(re * re) + Float64(im * im))) - re) <= 0.0) tmp = Float64(im * Float64(0.5 * (re ^ -0.5))); else tmp = sqrt(Float64(0.5 * Float64(hypot(im, re) - re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((sqrt(((re * re) + (im * im))) - re) <= 0.0) tmp = im * (0.5 * (re ^ -0.5)); else tmp = sqrt((0.5 * (hypot(im, re) - re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - re), $MachinePrecision], 0.0], N[(im * N[(0.5 * N[Power[re, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(0.5 * N[(N[Sqrt[im ^ 2 + re ^ 2], $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{re \cdot re + im \cdot im} - re \leq 0:\\
\;\;\;\;im \cdot \left(0.5 \cdot {re}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(\mathsf{hypot}\left(im, re\right) - re\right)}\\
\end{array}
\end{array}
if (-.f64 (sqrt.f64 (+.f64 (*.f64 re re) (*.f64 im im))) re) < 0.0Initial program 6.7%
pow16.7%
Applied egg-rr21.7%
unpow121.7%
*-commutative21.7%
associate-*r*21.7%
metadata-eval21.7%
hypot-undefine6.7%
unpow26.7%
unpow26.7%
+-commutative6.7%
unpow26.7%
unpow26.7%
hypot-undefine21.7%
Simplified21.7%
Taylor expanded in im around 0 85.8%
associate-*l*85.8%
unpow285.8%
rem-square-sqrt87.1%
unpow-187.1%
metadata-eval87.1%
pow-sqr87.2%
rem-sqrt-square87.2%
rem-square-sqrt86.7%
fabs-sqr86.7%
rem-square-sqrt87.2%
Simplified87.2%
if 0.0 < (-.f64 (sqrt.f64 (+.f64 (*.f64 re re) (*.f64 im im))) re) Initial program 49.8%
pow149.8%
Applied egg-rr91.4%
unpow191.4%
*-commutative91.4%
associate-*r*91.4%
metadata-eval91.4%
hypot-undefine49.8%
unpow249.8%
unpow249.8%
+-commutative49.8%
unpow249.8%
unpow249.8%
hypot-undefine91.4%
Simplified91.4%
(FPCore (re im)
:precision binary64
(if (<= re -9e-8)
(sqrt (- re))
(if (<= re 3.5e-103)
(sqrt (* 0.5 (- im re)))
(* im (* 0.5 (pow re -0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -9e-8) {
tmp = sqrt(-re);
} else if (re <= 3.5e-103) {
tmp = sqrt((0.5 * (im - re)));
} else {
tmp = im * (0.5 * pow(re, -0.5));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-9d-8)) then
tmp = sqrt(-re)
else if (re <= 3.5d-103) then
tmp = sqrt((0.5d0 * (im - re)))
else
tmp = im * (0.5d0 * (re ** (-0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -9e-8) {
tmp = Math.sqrt(-re);
} else if (re <= 3.5e-103) {
tmp = Math.sqrt((0.5 * (im - re)));
} else {
tmp = im * (0.5 * Math.pow(re, -0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -9e-8: tmp = math.sqrt(-re) elif re <= 3.5e-103: tmp = math.sqrt((0.5 * (im - re))) else: tmp = im * (0.5 * math.pow(re, -0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= -9e-8) tmp = sqrt(Float64(-re)); elseif (re <= 3.5e-103) tmp = sqrt(Float64(0.5 * Float64(im - re))); else tmp = Float64(im * Float64(0.5 * (re ^ -0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -9e-8) tmp = sqrt(-re); elseif (re <= 3.5e-103) tmp = sqrt((0.5 * (im - re))); else tmp = im * (0.5 * (re ^ -0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -9e-8], N[Sqrt[(-re)], $MachinePrecision], If[LessEqual[re, 3.5e-103], N[Sqrt[N[(0.5 * N[(im - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(im * N[(0.5 * N[Power[re, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -9 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{-re}\\
\mathbf{elif}\;re \leq 3.5 \cdot 10^{-103}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(im - re\right)}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot {re}^{-0.5}\right)\\
\end{array}
\end{array}
if re < -8.99999999999999986e-8Initial program 43.8%
pow143.8%
Applied egg-rr100.0%
unpow1100.0%
*-commutative100.0%
associate-*r*100.0%
metadata-eval100.0%
hypot-undefine43.8%
unpow243.8%
unpow243.8%
+-commutative43.8%
unpow243.8%
unpow243.8%
hypot-undefine100.0%
Simplified100.0%
Taylor expanded in re around -inf 81.9%
neg-mul-181.9%
Simplified81.9%
if -8.99999999999999986e-8 < re < 3.50000000000000016e-103Initial program 54.2%
pow154.2%
Applied egg-rr91.4%
unpow191.4%
*-commutative91.4%
associate-*r*91.4%
metadata-eval91.4%
hypot-undefine54.2%
unpow254.2%
unpow254.2%
+-commutative54.2%
unpow254.2%
unpow254.2%
hypot-undefine91.4%
Simplified91.4%
Taylor expanded in re around 0 82.1%
neg-mul-182.1%
unsub-neg82.1%
Simplified82.1%
if 3.50000000000000016e-103 < re Initial program 23.0%
pow123.0%
Applied egg-rr43.8%
unpow143.8%
*-commutative43.8%
associate-*r*43.8%
metadata-eval43.8%
hypot-undefine23.0%
unpow223.0%
unpow223.0%
+-commutative23.0%
unpow223.0%
unpow223.0%
hypot-undefine43.8%
Simplified43.8%
Taylor expanded in im around 0 69.9%
associate-*l*69.9%
unpow269.9%
rem-square-sqrt70.8%
unpow-170.8%
metadata-eval70.8%
pow-sqr70.9%
rem-sqrt-square70.9%
rem-square-sqrt70.6%
fabs-sqr70.6%
rem-square-sqrt70.9%
Simplified70.9%
(FPCore (re im) :precision binary64 (if (<= re -4.2e-8) (sqrt (- re)) (if (<= re 1.8e-103) (sqrt (* 0.5 (- im re))) (/ (* im 0.5) (sqrt re)))))
double code(double re, double im) {
double tmp;
if (re <= -4.2e-8) {
tmp = sqrt(-re);
} else if (re <= 1.8e-103) {
tmp = sqrt((0.5 * (im - re)));
} else {
tmp = (im * 0.5) / sqrt(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-4.2d-8)) then
tmp = sqrt(-re)
else if (re <= 1.8d-103) then
tmp = sqrt((0.5d0 * (im - re)))
else
tmp = (im * 0.5d0) / sqrt(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.2e-8) {
tmp = Math.sqrt(-re);
} else if (re <= 1.8e-103) {
tmp = Math.sqrt((0.5 * (im - re)));
} else {
tmp = (im * 0.5) / Math.sqrt(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.2e-8: tmp = math.sqrt(-re) elif re <= 1.8e-103: tmp = math.sqrt((0.5 * (im - re))) else: tmp = (im * 0.5) / math.sqrt(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.2e-8) tmp = sqrt(Float64(-re)); elseif (re <= 1.8e-103) tmp = sqrt(Float64(0.5 * Float64(im - re))); else tmp = Float64(Float64(im * 0.5) / sqrt(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.2e-8) tmp = sqrt(-re); elseif (re <= 1.8e-103) tmp = sqrt((0.5 * (im - re))); else tmp = (im * 0.5) / sqrt(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.2e-8], N[Sqrt[(-re)], $MachinePrecision], If[LessEqual[re, 1.8e-103], N[Sqrt[N[(0.5 * N[(im - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(im * 0.5), $MachinePrecision] / N[Sqrt[re], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.2 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{-re}\\
\mathbf{elif}\;re \leq 1.8 \cdot 10^{-103}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(im - re\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{im \cdot 0.5}{\sqrt{re}}\\
\end{array}
\end{array}
if re < -4.19999999999999989e-8Initial program 43.8%
pow143.8%
Applied egg-rr100.0%
unpow1100.0%
*-commutative100.0%
associate-*r*100.0%
metadata-eval100.0%
hypot-undefine43.8%
unpow243.8%
unpow243.8%
+-commutative43.8%
unpow243.8%
unpow243.8%
hypot-undefine100.0%
Simplified100.0%
Taylor expanded in re around -inf 81.9%
neg-mul-181.9%
Simplified81.9%
if -4.19999999999999989e-8 < re < 1.7999999999999999e-103Initial program 54.2%
pow154.2%
Applied egg-rr91.4%
unpow191.4%
*-commutative91.4%
associate-*r*91.4%
metadata-eval91.4%
hypot-undefine54.2%
unpow254.2%
unpow254.2%
+-commutative54.2%
unpow254.2%
unpow254.2%
hypot-undefine91.4%
Simplified91.4%
Taylor expanded in re around 0 82.1%
neg-mul-182.1%
unsub-neg82.1%
Simplified82.1%
if 1.7999999999999999e-103 < re Initial program 23.0%
Taylor expanded in re around inf 38.6%
sqrt-div44.0%
sqrt-pow170.8%
metadata-eval70.8%
pow170.8%
associate-*r/70.8%
Applied egg-rr70.8%
Final simplification78.6%
(FPCore (re im) :precision binary64 (if (<= re -3.4e-8) (sqrt (- re)) (if (<= re 5.1e-104) (sqrt (* 0.5 (- im re))) (* im (/ 0.5 (sqrt re))))))
double code(double re, double im) {
double tmp;
if (re <= -3.4e-8) {
tmp = sqrt(-re);
} else if (re <= 5.1e-104) {
tmp = sqrt((0.5 * (im - re)));
} else {
tmp = im * (0.5 / sqrt(re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-3.4d-8)) then
tmp = sqrt(-re)
else if (re <= 5.1d-104) then
tmp = sqrt((0.5d0 * (im - re)))
else
tmp = im * (0.5d0 / sqrt(re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -3.4e-8) {
tmp = Math.sqrt(-re);
} else if (re <= 5.1e-104) {
tmp = Math.sqrt((0.5 * (im - re)));
} else {
tmp = im * (0.5 / Math.sqrt(re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -3.4e-8: tmp = math.sqrt(-re) elif re <= 5.1e-104: tmp = math.sqrt((0.5 * (im - re))) else: tmp = im * (0.5 / math.sqrt(re)) return tmp
function code(re, im) tmp = 0.0 if (re <= -3.4e-8) tmp = sqrt(Float64(-re)); elseif (re <= 5.1e-104) tmp = sqrt(Float64(0.5 * Float64(im - re))); else tmp = Float64(im * Float64(0.5 / sqrt(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -3.4e-8) tmp = sqrt(-re); elseif (re <= 5.1e-104) tmp = sqrt((0.5 * (im - re))); else tmp = im * (0.5 / sqrt(re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -3.4e-8], N[Sqrt[(-re)], $MachinePrecision], If[LessEqual[re, 5.1e-104], N[Sqrt[N[(0.5 * N[(im - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(im * N[(0.5 / N[Sqrt[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -3.4 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{-re}\\
\mathbf{elif}\;re \leq 5.1 \cdot 10^{-104}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(im - re\right)}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \frac{0.5}{\sqrt{re}}\\
\end{array}
\end{array}
if re < -3.4e-8Initial program 43.8%
pow143.8%
Applied egg-rr100.0%
unpow1100.0%
*-commutative100.0%
associate-*r*100.0%
metadata-eval100.0%
hypot-undefine43.8%
unpow243.8%
unpow243.8%
+-commutative43.8%
unpow243.8%
unpow243.8%
hypot-undefine100.0%
Simplified100.0%
Taylor expanded in re around -inf 81.9%
neg-mul-181.9%
Simplified81.9%
if -3.4e-8 < re < 5.09999999999999992e-104Initial program 54.2%
pow154.2%
Applied egg-rr91.4%
unpow191.4%
*-commutative91.4%
associate-*r*91.4%
metadata-eval91.4%
hypot-undefine54.2%
unpow254.2%
unpow254.2%
+-commutative54.2%
unpow254.2%
unpow254.2%
hypot-undefine91.4%
Simplified91.4%
Taylor expanded in re around 0 82.1%
neg-mul-182.1%
unsub-neg82.1%
Simplified82.1%
if 5.09999999999999992e-104 < re Initial program 23.0%
Taylor expanded in re around inf 38.6%
sqrt-div44.0%
sqrt-pow170.8%
metadata-eval70.8%
pow170.8%
associate-*r/70.8%
Applied egg-rr70.8%
*-commutative70.8%
associate-/l*70.8%
Simplified70.8%
(FPCore (re im) :precision binary64 (if (<= re -2.2e-8) (sqrt (- re)) (sqrt (* im 0.5))))
double code(double re, double im) {
double tmp;
if (re <= -2.2e-8) {
tmp = sqrt(-re);
} else {
tmp = sqrt((im * 0.5));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-2.2d-8)) then
tmp = sqrt(-re)
else
tmp = sqrt((im * 0.5d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.2e-8) {
tmp = Math.sqrt(-re);
} else {
tmp = Math.sqrt((im * 0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.2e-8: tmp = math.sqrt(-re) else: tmp = math.sqrt((im * 0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.2e-8) tmp = sqrt(Float64(-re)); else tmp = sqrt(Float64(im * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.2e-8) tmp = sqrt(-re); else tmp = sqrt((im * 0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.2e-8], N[Sqrt[(-re)], $MachinePrecision], N[Sqrt[N[(im * 0.5), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.2 \cdot 10^{-8}:\\
\;\;\;\;\sqrt{-re}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{im \cdot 0.5}\\
\end{array}
\end{array}
if re < -2.1999999999999998e-8Initial program 43.8%
pow143.8%
Applied egg-rr100.0%
unpow1100.0%
*-commutative100.0%
associate-*r*100.0%
metadata-eval100.0%
hypot-undefine43.8%
unpow243.8%
unpow243.8%
+-commutative43.8%
unpow243.8%
unpow243.8%
hypot-undefine100.0%
Simplified100.0%
Taylor expanded in re around -inf 81.9%
neg-mul-181.9%
Simplified81.9%
if -2.1999999999999998e-8 < re Initial program 41.8%
pow141.8%
Applied egg-rr72.4%
unpow172.4%
*-commutative72.4%
associate-*r*72.4%
metadata-eval72.4%
hypot-undefine41.8%
unpow241.8%
unpow241.8%
+-commutative41.8%
unpow241.8%
unpow241.8%
hypot-undefine72.4%
Simplified72.4%
Taylor expanded in im around inf 61.1%
*-commutative61.1%
Simplified61.1%
(FPCore (re im) :precision binary64 (if (<= re -1e-309) (sqrt (- re)) 0.0))
double code(double re, double im) {
double tmp;
if (re <= -1e-309) {
tmp = sqrt(-re);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-1d-309)) then
tmp = sqrt(-re)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -1e-309) {
tmp = Math.sqrt(-re);
} else {
tmp = 0.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -1e-309: tmp = math.sqrt(-re) else: tmp = 0.0 return tmp
function code(re, im) tmp = 0.0 if (re <= -1e-309) tmp = sqrt(Float64(-re)); else tmp = 0.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -1e-309) tmp = sqrt(-re); else tmp = 0.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -1e-309], N[Sqrt[(-re)], $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{-re}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if re < -1.000000000000002e-309Initial program 54.2%
pow154.2%
Applied egg-rr100.0%
unpow1100.0%
*-commutative100.0%
associate-*r*100.0%
metadata-eval100.0%
hypot-undefine54.2%
unpow254.2%
unpow254.2%
+-commutative54.2%
unpow254.2%
unpow254.2%
hypot-undefine100.0%
Simplified100.0%
Taylor expanded in re around -inf 53.3%
neg-mul-153.3%
Simplified53.3%
if -1.000000000000002e-309 < re Initial program 31.2%
Taylor expanded in re around inf 8.6%
Taylor expanded in re around 0 8.6%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 42.3%
Taylor expanded in re around inf 5.9%
Taylor expanded in re around 0 5.9%
herbie shell --seed 2024136
(FPCore (re im)
:name "math.sqrt on complex, imaginary part, im greater than 0 branch"
:precision binary64
:pre (> im 0.0)
(* 0.5 (sqrt (* 2.0 (- (sqrt (+ (* re re) (* im im))) re)))))