
(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 6 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 (* 2.0 (- (sqrt (+ (* re re) (* im im))) re))) 0.0) (* 0.5 (* im (pow re -0.5))) (* 0.5 (sqrt (* 2.0 (- (hypot re im) re))))))
double code(double re, double im) {
double tmp;
if (sqrt((2.0 * (sqrt(((re * re) + (im * im))) - re))) <= 0.0) {
tmp = 0.5 * (im * pow(re, -0.5));
} else {
tmp = 0.5 * sqrt((2.0 * (hypot(re, im) - re)));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (Math.sqrt((2.0 * (Math.sqrt(((re * re) + (im * im))) - re))) <= 0.0) {
tmp = 0.5 * (im * Math.pow(re, -0.5));
} else {
tmp = 0.5 * Math.sqrt((2.0 * (Math.hypot(re, im) - re)));
}
return tmp;
}
def code(re, im): tmp = 0 if math.sqrt((2.0 * (math.sqrt(((re * re) + (im * im))) - re))) <= 0.0: tmp = 0.5 * (im * math.pow(re, -0.5)) else: tmp = 0.5 * math.sqrt((2.0 * (math.hypot(re, im) - re))) return tmp
function code(re, im) tmp = 0.0 if (sqrt(Float64(2.0 * Float64(sqrt(Float64(Float64(re * re) + Float64(im * im))) - re))) <= 0.0) tmp = Float64(0.5 * Float64(im * (re ^ -0.5))); else tmp = Float64(0.5 * sqrt(Float64(2.0 * Float64(hypot(re, im) - re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (sqrt((2.0 * (sqrt(((re * re) + (im * im))) - re))) <= 0.0) tmp = 0.5 * (im * (re ^ -0.5)); else tmp = 0.5 * sqrt((2.0 * (hypot(re, im) - re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Sqrt[N[(2.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.0], N[(0.5 * N[(im * N[Power[re, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(2.0 * N[(N[Sqrt[re ^ 2 + im ^ 2], $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \leq 0:\\
\;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}\\
\end{array}
\end{array}
if (sqrt.f64 (*.f64 2 (-.f64 (sqrt.f64 (+.f64 (*.f64 re re) (*.f64 im im))) re))) < 0.0Initial program 4.5%
Taylor expanded in im around 0 98.2%
associate-*l*98.3%
*-commutative98.3%
Simplified98.3%
expm1-log1p-u97.9%
expm1-udef21.1%
sqrt-unprod21.2%
metadata-eval21.2%
metadata-eval21.2%
*-un-lft-identity21.2%
sqrt-div21.2%
metadata-eval21.2%
un-div-inv21.2%
Applied egg-rr21.2%
expm1-def99.1%
expm1-log1p99.6%
Simplified99.6%
clear-num99.2%
associate-/r/99.5%
pow1/299.5%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
if 0.0 < (sqrt.f64 (*.f64 2 (-.f64 (sqrt.f64 (+.f64 (*.f64 re re) (*.f64 im im))) re))) Initial program 51.2%
sqr-neg51.2%
sqr-neg51.2%
hypot-def89.5%
Simplified89.5%
Final simplification90.6%
(FPCore (re im)
:precision binary64
(if (<= re -5.4e-94)
(* 0.5 (sqrt (* 2.0 (* re -2.0))))
(if (<= re 2.7e+96)
(* 0.5 (sqrt (* 2.0 (- im re))))
(* 0.5 (* im (pow re -0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -5.4e-94) {
tmp = 0.5 * sqrt((2.0 * (re * -2.0)));
} else if (re <= 2.7e+96) {
tmp = 0.5 * sqrt((2.0 * (im - re)));
} else {
tmp = 0.5 * (im * 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 <= (-5.4d-94)) then
tmp = 0.5d0 * sqrt((2.0d0 * (re * (-2.0d0))))
else if (re <= 2.7d+96) then
tmp = 0.5d0 * sqrt((2.0d0 * (im - re)))
else
tmp = 0.5d0 * (im * (re ** (-0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -5.4e-94) {
tmp = 0.5 * Math.sqrt((2.0 * (re * -2.0)));
} else if (re <= 2.7e+96) {
tmp = 0.5 * Math.sqrt((2.0 * (im - re)));
} else {
tmp = 0.5 * (im * Math.pow(re, -0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -5.4e-94: tmp = 0.5 * math.sqrt((2.0 * (re * -2.0))) elif re <= 2.7e+96: tmp = 0.5 * math.sqrt((2.0 * (im - re))) else: tmp = 0.5 * (im * math.pow(re, -0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= -5.4e-94) tmp = Float64(0.5 * sqrt(Float64(2.0 * Float64(re * -2.0)))); elseif (re <= 2.7e+96) tmp = Float64(0.5 * sqrt(Float64(2.0 * Float64(im - re)))); else tmp = Float64(0.5 * Float64(im * (re ^ -0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -5.4e-94) tmp = 0.5 * sqrt((2.0 * (re * -2.0))); elseif (re <= 2.7e+96) tmp = 0.5 * sqrt((2.0 * (im - re))); else tmp = 0.5 * (im * (re ^ -0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -5.4e-94], N[(0.5 * N[Sqrt[N[(2.0 * N[(re * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.7e+96], N[(0.5 * N[Sqrt[N[(2.0 * N[(im - re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[Power[re, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -5.4 \cdot 10^{-94}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re \cdot -2\right)}\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+96}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(im - re\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\
\end{array}
\end{array}
if re < -5.4000000000000002e-94Initial program 53.5%
Taylor expanded in re around -inf 71.6%
*-commutative71.6%
Simplified71.6%
if -5.4000000000000002e-94 < re < 2.70000000000000022e96Initial program 58.1%
Taylor expanded in re around 0 80.9%
if 2.70000000000000022e96 < re Initial program 4.8%
Taylor expanded in im around 0 76.8%
associate-*l*76.8%
*-commutative76.8%
Simplified76.8%
expm1-log1p-u76.4%
expm1-udef24.4%
sqrt-unprod24.4%
metadata-eval24.4%
metadata-eval24.4%
*-un-lft-identity24.4%
sqrt-div24.4%
metadata-eval24.4%
un-div-inv24.4%
Applied egg-rr24.4%
expm1-def77.1%
expm1-log1p77.6%
Simplified77.6%
clear-num77.5%
associate-/r/77.6%
pow1/277.6%
pow-flip77.8%
metadata-eval77.8%
Applied egg-rr77.8%
Final simplification77.8%
(FPCore (re im)
:precision binary64
(if (<= re -5.2e-94)
(* 0.5 (sqrt (* 2.0 (* re -2.0))))
(if (<= re 2.7e+96)
(* 0.5 (sqrt (* 2.0 im)))
(* 0.5 (* im (pow re -0.5))))))
double code(double re, double im) {
double tmp;
if (re <= -5.2e-94) {
tmp = 0.5 * sqrt((2.0 * (re * -2.0)));
} else if (re <= 2.7e+96) {
tmp = 0.5 * sqrt((2.0 * im));
} else {
tmp = 0.5 * (im * 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 <= (-5.2d-94)) then
tmp = 0.5d0 * sqrt((2.0d0 * (re * (-2.0d0))))
else if (re <= 2.7d+96) then
tmp = 0.5d0 * sqrt((2.0d0 * im))
else
tmp = 0.5d0 * (im * (re ** (-0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -5.2e-94) {
tmp = 0.5 * Math.sqrt((2.0 * (re * -2.0)));
} else if (re <= 2.7e+96) {
tmp = 0.5 * Math.sqrt((2.0 * im));
} else {
tmp = 0.5 * (im * Math.pow(re, -0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -5.2e-94: tmp = 0.5 * math.sqrt((2.0 * (re * -2.0))) elif re <= 2.7e+96: tmp = 0.5 * math.sqrt((2.0 * im)) else: tmp = 0.5 * (im * math.pow(re, -0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= -5.2e-94) tmp = Float64(0.5 * sqrt(Float64(2.0 * Float64(re * -2.0)))); elseif (re <= 2.7e+96) tmp = Float64(0.5 * sqrt(Float64(2.0 * im))); else tmp = Float64(0.5 * Float64(im * (re ^ -0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -5.2e-94) tmp = 0.5 * sqrt((2.0 * (re * -2.0))); elseif (re <= 2.7e+96) tmp = 0.5 * sqrt((2.0 * im)); else tmp = 0.5 * (im * (re ^ -0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -5.2e-94], N[(0.5 * N[Sqrt[N[(2.0 * N[(re * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.7e+96], N[(0.5 * N[Sqrt[N[(2.0 * im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[Power[re, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -5.2 \cdot 10^{-94}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re \cdot -2\right)}\\
\mathbf{elif}\;re \leq 2.7 \cdot 10^{+96}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\
\end{array}
\end{array}
if re < -5.19999999999999988e-94Initial program 53.5%
Taylor expanded in re around -inf 71.6%
*-commutative71.6%
Simplified71.6%
if -5.19999999999999988e-94 < re < 2.70000000000000022e96Initial program 58.1%
Taylor expanded in re around 0 80.3%
expm1-log1p-u76.3%
expm1-udef55.2%
*-commutative55.2%
sqrt-unprod55.2%
Applied egg-rr55.2%
expm1-def76.6%
expm1-log1p80.8%
*-commutative80.8%
Simplified80.8%
if 2.70000000000000022e96 < re Initial program 4.8%
Taylor expanded in im around 0 76.8%
associate-*l*76.8%
*-commutative76.8%
Simplified76.8%
expm1-log1p-u76.4%
expm1-udef24.4%
sqrt-unprod24.4%
metadata-eval24.4%
metadata-eval24.4%
*-un-lft-identity24.4%
sqrt-div24.4%
metadata-eval24.4%
un-div-inv24.4%
Applied egg-rr24.4%
expm1-def77.1%
expm1-log1p77.6%
Simplified77.6%
clear-num77.5%
associate-/r/77.6%
pow1/277.6%
pow-flip77.8%
metadata-eval77.8%
Applied egg-rr77.8%
Final simplification77.7%
(FPCore (re im) :precision binary64 (if (<= re 1.55e+97) (* 0.5 (sqrt (* 2.0 im))) (* 0.5 (* im (pow re -0.5)))))
double code(double re, double im) {
double tmp;
if (re <= 1.55e+97) {
tmp = 0.5 * sqrt((2.0 * im));
} else {
tmp = 0.5 * (im * 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 <= 1.55d+97) then
tmp = 0.5d0 * sqrt((2.0d0 * im))
else
tmp = 0.5d0 * (im * (re ** (-0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.55e+97) {
tmp = 0.5 * Math.sqrt((2.0 * im));
} else {
tmp = 0.5 * (im * Math.pow(re, -0.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.55e+97: tmp = 0.5 * math.sqrt((2.0 * im)) else: tmp = 0.5 * (im * math.pow(re, -0.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.55e+97) tmp = Float64(0.5 * sqrt(Float64(2.0 * im))); else tmp = Float64(0.5 * Float64(im * (re ^ -0.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.55e+97) tmp = 0.5 * sqrt((2.0 * im)); else tmp = 0.5 * (im * (re ^ -0.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.55e+97], N[(0.5 * N[Sqrt[N[(2.0 * im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[Power[re, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.55 \cdot 10^{+97}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\
\end{array}
\end{array}
if re < 1.54999999999999991e97Initial program 56.6%
Taylor expanded in re around 0 64.8%
expm1-log1p-u61.5%
expm1-udef46.4%
*-commutative46.4%
sqrt-unprod46.4%
Applied egg-rr46.4%
expm1-def61.6%
expm1-log1p65.3%
*-commutative65.3%
Simplified65.3%
if 1.54999999999999991e97 < re Initial program 4.8%
Taylor expanded in im around 0 76.8%
associate-*l*76.8%
*-commutative76.8%
Simplified76.8%
expm1-log1p-u76.4%
expm1-udef24.4%
sqrt-unprod24.4%
metadata-eval24.4%
metadata-eval24.4%
*-un-lft-identity24.4%
sqrt-div24.4%
metadata-eval24.4%
un-div-inv24.4%
Applied egg-rr24.4%
expm1-def77.1%
expm1-log1p77.6%
Simplified77.6%
clear-num77.5%
associate-/r/77.6%
pow1/277.6%
pow-flip77.8%
metadata-eval77.8%
Applied egg-rr77.8%
Final simplification67.7%
(FPCore (re im) :precision binary64 (if (<= re 3.2e+96) (* 0.5 (sqrt (* 2.0 im))) (* 0.5 (/ im (sqrt re)))))
double code(double re, double im) {
double tmp;
if (re <= 3.2e+96) {
tmp = 0.5 * sqrt((2.0 * im));
} else {
tmp = 0.5 * (im / 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.2d+96) then
tmp = 0.5d0 * sqrt((2.0d0 * im))
else
tmp = 0.5d0 * (im / sqrt(re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 3.2e+96) {
tmp = 0.5 * Math.sqrt((2.0 * im));
} else {
tmp = 0.5 * (im / Math.sqrt(re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.2e+96: tmp = 0.5 * math.sqrt((2.0 * im)) else: tmp = 0.5 * (im / math.sqrt(re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 3.2e+96) tmp = Float64(0.5 * sqrt(Float64(2.0 * im))); else tmp = Float64(0.5 * Float64(im / sqrt(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 3.2e+96) tmp = 0.5 * sqrt((2.0 * im)); else tmp = 0.5 * (im / sqrt(re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.2e+96], N[(0.5 * N[Sqrt[N[(2.0 * im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im / N[Sqrt[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3.2 \cdot 10^{+96}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{im}{\sqrt{re}}\\
\end{array}
\end{array}
if re < 3.20000000000000006e96Initial program 56.6%
Taylor expanded in re around 0 64.8%
expm1-log1p-u61.5%
expm1-udef46.4%
*-commutative46.4%
sqrt-unprod46.4%
Applied egg-rr46.4%
expm1-def61.6%
expm1-log1p65.3%
*-commutative65.3%
Simplified65.3%
if 3.20000000000000006e96 < re Initial program 4.8%
Taylor expanded in im around 0 76.8%
associate-*l*76.8%
*-commutative76.8%
Simplified76.8%
expm1-log1p-u76.4%
expm1-udef24.4%
sqrt-unprod24.4%
metadata-eval24.4%
metadata-eval24.4%
*-un-lft-identity24.4%
sqrt-div24.4%
metadata-eval24.4%
un-div-inv24.4%
Applied egg-rr24.4%
expm1-def77.1%
expm1-log1p77.6%
Simplified77.6%
Final simplification67.7%
(FPCore (re im) :precision binary64 (* 0.5 (sqrt (* 2.0 im))))
double code(double re, double im) {
return 0.5 * sqrt((2.0 * im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * sqrt((2.0d0 * im))
end function
public static double code(double re, double im) {
return 0.5 * Math.sqrt((2.0 * im));
}
def code(re, im): return 0.5 * math.sqrt((2.0 * im))
function code(re, im) return Float64(0.5 * sqrt(Float64(2.0 * im))) end
function tmp = code(re, im) tmp = 0.5 * sqrt((2.0 * im)); end
code[re_, im_] := N[(0.5 * N[Sqrt[N[(2.0 * im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \sqrt{2 \cdot im}
\end{array}
Initial program 46.2%
Taylor expanded in re around 0 57.4%
expm1-log1p-u54.3%
expm1-udef43.4%
*-commutative43.4%
sqrt-unprod43.4%
Applied egg-rr43.4%
expm1-def54.4%
expm1-log1p57.7%
*-commutative57.7%
Simplified57.7%
Final simplification57.7%
herbie shell --seed 2023307
(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)))))