
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= re -0.00012)
(exp re)
(if (<= re 0.00023)
(* (cos im) (+ re 1.0))
(if (<= re 7e+269) (exp re) (* (+ 1.0 (* -0.5 (* im im))) (+ re 1.0))))))
double code(double re, double im) {
double tmp;
if (re <= -0.00012) {
tmp = exp(re);
} else if (re <= 0.00023) {
tmp = cos(im) * (re + 1.0);
} else if (re <= 7e+269) {
tmp = exp(re);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-0.00012d0)) then
tmp = exp(re)
else if (re <= 0.00023d0) then
tmp = cos(im) * (re + 1.0d0)
else if (re <= 7d+269) then
tmp = exp(re)
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.00012) {
tmp = Math.exp(re);
} else if (re <= 0.00023) {
tmp = Math.cos(im) * (re + 1.0);
} else if (re <= 7e+269) {
tmp = Math.exp(re);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.00012: tmp = math.exp(re) elif re <= 0.00023: tmp = math.cos(im) * (re + 1.0) elif re <= 7e+269: tmp = math.exp(re) else: tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.00012) tmp = exp(re); elseif (re <= 0.00023) tmp = Float64(cos(im) * Float64(re + 1.0)); elseif (re <= 7e+269) tmp = exp(re); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.00012) tmp = exp(re); elseif (re <= 0.00023) tmp = cos(im) * (re + 1.0); elseif (re <= 7e+269) tmp = exp(re); else tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.00012], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.00023], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 7e+269], N[Exp[re], $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.00012:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.00023:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 7 \cdot 10^{+269}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if re < -1.20000000000000003e-4 or 2.3000000000000001e-4 < re < 7.0000000000000003e269Initial program 100.0%
Taylor expanded in im around 0 91.0%
if -1.20000000000000003e-4 < re < 2.3000000000000001e-4Initial program 100.0%
Taylor expanded in re around 0 99.8%
distribute-rgt1-in99.8%
Simplified99.8%
if 7.0000000000000003e269 < re Initial program 100.0%
Taylor expanded in re around 0 11.1%
distribute-rgt1-in11.1%
Simplified11.1%
Taylor expanded in im around 0 87.9%
associate-+r+87.9%
+-commutative87.9%
associate-*r*87.9%
+-commutative87.9%
distribute-rgt1-in87.9%
Simplified87.9%
unpow287.9%
Applied egg-rr87.9%
Final simplification95.5%
(FPCore (re im)
:precision binary64
(if (<= re -7.2e-10)
(exp re)
(if (<= re 0.000172)
(cos im)
(if (<= re 7e+269) (exp re) (* (+ 1.0 (* -0.5 (* im im))) (+ re 1.0))))))
double code(double re, double im) {
double tmp;
if (re <= -7.2e-10) {
tmp = exp(re);
} else if (re <= 0.000172) {
tmp = cos(im);
} else if (re <= 7e+269) {
tmp = exp(re);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-7.2d-10)) then
tmp = exp(re)
else if (re <= 0.000172d0) then
tmp = cos(im)
else if (re <= 7d+269) then
tmp = exp(re)
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -7.2e-10) {
tmp = Math.exp(re);
} else if (re <= 0.000172) {
tmp = Math.cos(im);
} else if (re <= 7e+269) {
tmp = Math.exp(re);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -7.2e-10: tmp = math.exp(re) elif re <= 0.000172: tmp = math.cos(im) elif re <= 7e+269: tmp = math.exp(re) else: tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if (re <= -7.2e-10) tmp = exp(re); elseif (re <= 0.000172) tmp = cos(im); elseif (re <= 7e+269) tmp = exp(re); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -7.2e-10) tmp = exp(re); elseif (re <= 0.000172) tmp = cos(im); elseif (re <= 7e+269) tmp = exp(re); else tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -7.2e-10], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.000172], N[Cos[im], $MachinePrecision], If[LessEqual[re, 7e+269], N[Exp[re], $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -7.2 \cdot 10^{-10}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.000172:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 7 \cdot 10^{+269}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if re < -7.2e-10 or 1.7200000000000001e-4 < re < 7.0000000000000003e269Initial program 100.0%
Taylor expanded in im around 0 91.0%
if -7.2e-10 < re < 1.7200000000000001e-4Initial program 100.0%
Taylor expanded in re around 0 99.2%
if 7.0000000000000003e269 < re Initial program 100.0%
Taylor expanded in re around 0 11.1%
distribute-rgt1-in11.1%
Simplified11.1%
Taylor expanded in im around 0 87.9%
associate-+r+87.9%
+-commutative87.9%
associate-*r*87.9%
+-commutative87.9%
distribute-rgt1-in87.9%
Simplified87.9%
unpow287.9%
Applied egg-rr87.9%
Final simplification95.1%
(FPCore (re im) :precision binary64 (if (<= re -480.0) (* -0.5 (* (* im im) (+ re 1.0))) (if (<= re 0.00072) (cos im) (* (+ 1.0 (* -0.5 (* im im))) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if (re <= -480.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 0.00072) {
tmp = cos(im);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-480.0d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 0.00072d0) then
tmp = cos(im)
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -480.0) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 0.00072) {
tmp = Math.cos(im);
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -480.0: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 0.00072: tmp = math.cos(im) else: tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if (re <= -480.0) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 0.00072) tmp = cos(im); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -480.0) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 0.00072) tmp = cos(im); else tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -480.0], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 0.00072], N[Cos[im], $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -480:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 0.00072:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if re < -480Initial program 100.0%
Taylor expanded in re around 0 2.2%
distribute-rgt1-in2.2%
Simplified2.2%
Taylor expanded in im around 0 1.9%
associate-+r+1.9%
+-commutative1.9%
associate-*r*1.9%
+-commutative1.9%
distribute-rgt1-in1.9%
Simplified1.9%
Taylor expanded in im around inf 28.0%
+-commutative28.0%
Simplified28.0%
unpow21.9%
Applied egg-rr28.0%
if -480 < re < 7.20000000000000045e-4Initial program 100.0%
Taylor expanded in re around 0 99.2%
if 7.20000000000000045e-4 < re Initial program 100.0%
Taylor expanded in re around 0 6.1%
distribute-rgt1-in6.1%
Simplified6.1%
Taylor expanded in im around 0 23.2%
associate-+r+23.2%
+-commutative23.2%
associate-*r*23.2%
+-commutative23.2%
distribute-rgt1-in23.2%
Simplified23.2%
unpow223.2%
Applied egg-rr23.2%
Final simplification63.5%
(FPCore (re im) :precision binary64 (if (<= re -12.5) (* -0.5 (* (* im im) (+ re 1.0))) (if (<= re 9e+22) (+ re 1.0) (* (+ 1.0 (* -0.5 (* im im))) (+ re 1.0)))))
double code(double re, double im) {
double tmp;
if (re <= -12.5) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 9e+22) {
tmp = re + 1.0;
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-12.5d0)) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else if (re <= 9d+22) then
tmp = re + 1.0d0
else
tmp = (1.0d0 + ((-0.5d0) * (im * im))) * (re + 1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -12.5) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else if (re <= 9e+22) {
tmp = re + 1.0;
} else {
tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -12.5: tmp = -0.5 * ((im * im) * (re + 1.0)) elif re <= 9e+22: tmp = re + 1.0 else: tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0) return tmp
function code(re, im) tmp = 0.0 if (re <= -12.5) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); elseif (re <= 9e+22) tmp = Float64(re + 1.0); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(im * im))) * Float64(re + 1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -12.5) tmp = -0.5 * ((im * im) * (re + 1.0)); elseif (re <= 9e+22) tmp = re + 1.0; else tmp = (1.0 + (-0.5 * (im * im))) * (re + 1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -12.5], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 9e+22], N[(re + 1.0), $MachinePrecision], N[(N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -12.5:\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{elif}\;re \leq 9 \cdot 10^{+22}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\end{array}
\end{array}
if re < -12.5Initial program 100.0%
Taylor expanded in re around 0 2.2%
distribute-rgt1-in2.2%
Simplified2.2%
Taylor expanded in im around 0 1.9%
associate-+r+1.9%
+-commutative1.9%
associate-*r*1.9%
+-commutative1.9%
distribute-rgt1-in1.9%
Simplified1.9%
Taylor expanded in im around inf 28.0%
+-commutative28.0%
Simplified28.0%
unpow21.9%
Applied egg-rr28.0%
if -12.5 < re < 8.9999999999999996e22Initial program 100.0%
Taylor expanded in re around 0 92.9%
distribute-rgt1-in92.9%
Simplified92.9%
Taylor expanded in im around 0 43.1%
associate-+r+43.1%
+-commutative43.1%
associate-*r*43.1%
+-commutative43.1%
distribute-rgt1-in43.1%
Simplified43.1%
unpow243.1%
Applied egg-rr43.1%
Taylor expanded in im around 0 48.9%
if 8.9999999999999996e22 < re Initial program 100.0%
Taylor expanded in re around 0 5.3%
distribute-rgt1-in5.3%
Simplified5.3%
Taylor expanded in im around 0 25.9%
associate-+r+25.9%
+-commutative25.9%
associate-*r*25.9%
+-commutative25.9%
distribute-rgt1-in25.9%
Simplified25.9%
unpow225.9%
Applied egg-rr25.9%
Final simplification39.2%
(FPCore (re im) :precision binary64 (if (or (<= re -6.2) (not (<= re 1.85e+28))) (* -0.5 (* (* im im) (+ re 1.0))) (+ re 1.0)))
double code(double re, double im) {
double tmp;
if ((re <= -6.2) || !(re <= 1.85e+28)) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else {
tmp = re + 1.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-6.2d0)) .or. (.not. (re <= 1.85d+28))) then
tmp = (-0.5d0) * ((im * im) * (re + 1.0d0))
else
tmp = re + 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -6.2) || !(re <= 1.85e+28)) {
tmp = -0.5 * ((im * im) * (re + 1.0));
} else {
tmp = re + 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -6.2) or not (re <= 1.85e+28): tmp = -0.5 * ((im * im) * (re + 1.0)) else: tmp = re + 1.0 return tmp
function code(re, im) tmp = 0.0 if ((re <= -6.2) || !(re <= 1.85e+28)) tmp = Float64(-0.5 * Float64(Float64(im * im) * Float64(re + 1.0))); else tmp = Float64(re + 1.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -6.2) || ~((re <= 1.85e+28))) tmp = -0.5 * ((im * im) * (re + 1.0)); else tmp = re + 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -6.2], N[Not[LessEqual[re, 1.85e+28]], $MachinePrecision]], N[(-0.5 * N[(N[(im * im), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -6.2 \lor \neg \left(re \leq 1.85 \cdot 10^{+28}\right):\\
\;\;\;\;-0.5 \cdot \left(\left(im \cdot im\right) \cdot \left(re + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re + 1\\
\end{array}
\end{array}
if re < -6.20000000000000018 or 1.85e28 < re Initial program 100.0%
Taylor expanded in re around 0 3.8%
distribute-rgt1-in3.8%
Simplified3.8%
Taylor expanded in im around 0 14.0%
associate-+r+14.0%
+-commutative14.0%
associate-*r*14.0%
+-commutative14.0%
distribute-rgt1-in14.0%
Simplified14.0%
Taylor expanded in im around inf 26.5%
+-commutative26.5%
Simplified26.5%
unpow214.0%
Applied egg-rr26.5%
if -6.20000000000000018 < re < 1.85e28Initial program 100.0%
Taylor expanded in re around 0 91.7%
distribute-rgt1-in91.7%
Simplified91.7%
Taylor expanded in im around 0 42.6%
associate-+r+42.6%
+-commutative42.6%
associate-*r*42.6%
+-commutative42.6%
distribute-rgt1-in42.6%
Simplified42.6%
unpow242.6%
Applied egg-rr42.6%
Taylor expanded in im around 0 48.2%
Final simplification38.8%
(FPCore (re im) :precision binary64 (+ re 1.0))
double code(double re, double im) {
return re + 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + 1.0d0
end function
public static double code(double re, double im) {
return re + 1.0;
}
def code(re, im): return re + 1.0
function code(re, im) return Float64(re + 1.0) end
function tmp = code(re, im) tmp = re + 1.0; end
code[re_, im_] := N[(re + 1.0), $MachinePrecision]
\begin{array}{l}
\\
re + 1
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 53.6%
distribute-rgt1-in53.6%
Simplified53.6%
Taylor expanded in im around 0 30.2%
associate-+r+30.2%
+-commutative30.2%
associate-*r*30.2%
+-commutative30.2%
distribute-rgt1-in30.2%
Simplified30.2%
unpow230.2%
Applied egg-rr30.2%
Taylor expanded in im around 0 28.6%
Final simplification28.6%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 53.6%
distribute-rgt1-in53.6%
Simplified53.6%
Taylor expanded in re around inf 3.9%
Taylor expanded in im around 0 3.5%
Final simplification3.5%
herbie shell --seed 2023321
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))