
(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 9 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 (<= (exp re) 0.99999995) (exp re) (if (<= (exp re) 1.000000000005) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.99999995) {
tmp = exp(re);
} else if (exp(re) <= 1.000000000005) {
tmp = cos(im);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (exp(re) <= 0.99999995d0) then
tmp = exp(re)
else if (exp(re) <= 1.000000000005d0) then
tmp = cos(im)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.exp(re) <= 0.99999995) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.000000000005) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.99999995: tmp = math.exp(re) elif math.exp(re) <= 1.000000000005: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.99999995) tmp = exp(re); elseif (exp(re) <= 1.000000000005) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.99999995) tmp = exp(re); elseif (exp(re) <= 1.000000000005) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.99999995], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.000000000005], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.99999995:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1.000000000005:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.999999949999999971 or 1.000000000005 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0 83.8%
if 0.999999949999999971 < (exp.f64 re) < 1.000000000005Initial program 100.0%
Taylor expanded in re around 0 99.6%
Final simplification92.4%
(FPCore (re im)
:precision binary64
(if (<= re -8e-8)
(exp re)
(if (<= re 0.042)
(* (cos im) (+ (+ re 1.0) (* re (* re 0.5))))
(if (<= re 1.05e+103)
(exp re)
(*
(cos im)
(+ (+ re 1.0) (* (* re re) (+ 0.5 (* re 0.16666666666666666)))))))))
double code(double re, double im) {
double tmp;
if (re <= -8e-8) {
tmp = exp(re);
} else if (re <= 0.042) {
tmp = cos(im) * ((re + 1.0) + (re * (re * 0.5)));
} else if (re <= 1.05e+103) {
tmp = exp(re);
} else {
tmp = cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-8d-8)) then
tmp = exp(re)
else if (re <= 0.042d0) then
tmp = cos(im) * ((re + 1.0d0) + (re * (re * 0.5d0)))
else if (re <= 1.05d+103) then
tmp = exp(re)
else
tmp = cos(im) * ((re + 1.0d0) + ((re * re) * (0.5d0 + (re * 0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -8e-8) {
tmp = Math.exp(re);
} else if (re <= 0.042) {
tmp = Math.cos(im) * ((re + 1.0) + (re * (re * 0.5)));
} else if (re <= 1.05e+103) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -8e-8: tmp = math.exp(re) elif re <= 0.042: tmp = math.cos(im) * ((re + 1.0) + (re * (re * 0.5))) elif re <= 1.05e+103: tmp = math.exp(re) else: tmp = math.cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -8e-8) tmp = exp(re); elseif (re <= 0.042) tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(re * Float64(re * 0.5)))); elseif (re <= 1.05e+103) tmp = exp(re); else tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(Float64(re * re) * Float64(0.5 + Float64(re * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -8e-8) tmp = exp(re); elseif (re <= 0.042) tmp = cos(im) * ((re + 1.0) + (re * (re * 0.5))); elseif (re <= 1.05e+103) tmp = exp(re); else tmp = cos(im) * ((re + 1.0) + ((re * re) * (0.5 + (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -8e-8], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.042], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.05e+103], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -8 \cdot 10^{-8}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.042:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + re \cdot \left(re \cdot 0.5\right)\right)\\
\mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + \left(re \cdot re\right) \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -8.0000000000000002e-8 or 0.0420000000000000026 < re < 1.0500000000000001e103Initial program 100.0%
Taylor expanded in im around 0 92.5%
if -8.0000000000000002e-8 < re < 0.0420000000000000026Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
if 1.0500000000000001e103 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
associate-+r+100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
cube-mult100.0%
unpow2100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification97.6%
(FPCore (re im) :precision binary64 (if (or (<= re -8e-8) (and (not (<= re 0.0021)) (<= re 1.9e+154))) (exp re) (* (cos im) (+ (+ re 1.0) (* re (* re 0.5))))))
double code(double re, double im) {
double tmp;
if ((re <= -8e-8) || (!(re <= 0.0021) && (re <= 1.9e+154))) {
tmp = exp(re);
} else {
tmp = cos(im) * ((re + 1.0) + (re * (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 <= (-8d-8)) .or. (.not. (re <= 0.0021d0)) .and. (re <= 1.9d+154)) then
tmp = exp(re)
else
tmp = cos(im) * ((re + 1.0d0) + (re * (re * 0.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -8e-8) || (!(re <= 0.0021) && (re <= 1.9e+154))) {
tmp = Math.exp(re);
} else {
tmp = Math.cos(im) * ((re + 1.0) + (re * (re * 0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -8e-8) or (not (re <= 0.0021) and (re <= 1.9e+154)): tmp = math.exp(re) else: tmp = math.cos(im) * ((re + 1.0) + (re * (re * 0.5))) return tmp
function code(re, im) tmp = 0.0 if ((re <= -8e-8) || (!(re <= 0.0021) && (re <= 1.9e+154))) tmp = exp(re); else tmp = Float64(cos(im) * Float64(Float64(re + 1.0) + Float64(re * Float64(re * 0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -8e-8) || (~((re <= 0.0021)) && (re <= 1.9e+154))) tmp = exp(re); else tmp = cos(im) * ((re + 1.0) + (re * (re * 0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -8e-8], And[N[Not[LessEqual[re, 0.0021]], $MachinePrecision], LessEqual[re, 1.9e+154]]], N[Exp[re], $MachinePrecision], N[(N[Cos[im], $MachinePrecision] * N[(N[(re + 1.0), $MachinePrecision] + N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -8 \cdot 10^{-8} \lor \neg \left(re \leq 0.0021\right) \land re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if re < -8.0000000000000002e-8 or 0.00209999999999999987 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 90.5%
if -8.0000000000000002e-8 < re < 0.00209999999999999987 or 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft1-in100.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification96.9%
(FPCore (re im) :precision binary64 (if (<= re -5e-8) (exp re) (if (<= re 0.03) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -5e-8) {
tmp = exp(re);
} else if (re <= 0.03) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-5d-8)) then
tmp = exp(re)
else if (re <= 0.03d0) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -5e-8) {
tmp = Math.exp(re);
} else if (re <= 0.03) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -5e-8: tmp = math.exp(re) elif re <= 0.03: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -5e-8) tmp = exp(re); elseif (re <= 0.03) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -5e-8) tmp = exp(re); elseif (re <= 0.03) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -5e-8], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.03], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -5 \cdot 10^{-8}:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.03:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -4.9999999999999998e-8 or 0.029999999999999999 < re Initial program 100.0%
Taylor expanded in im around 0 84.1%
if -4.9999999999999998e-8 < re < 0.029999999999999999Initial program 100.0%
Taylor expanded in re around 0 99.8%
*-rgt-identity99.8%
distribute-lft-in99.8%
Simplified99.8%
Final simplification92.9%
(FPCore (re im) :precision binary64 (if (<= re 6.4e-12) (cos im) (+ (+ re 1.0) (* (* re -0.5) (* im im)))))
double code(double re, double im) {
double tmp;
if (re <= 6.4e-12) {
tmp = cos(im);
} else {
tmp = (re + 1.0) + ((re * -0.5) * (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 6.4d-12) then
tmp = cos(im)
else
tmp = (re + 1.0d0) + ((re * (-0.5d0)) * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 6.4e-12) {
tmp = Math.cos(im);
} else {
tmp = (re + 1.0) + ((re * -0.5) * (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 6.4e-12: tmp = math.cos(im) else: tmp = (re + 1.0) + ((re * -0.5) * (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= 6.4e-12) tmp = cos(im); else tmp = Float64(Float64(re + 1.0) + Float64(Float64(re * -0.5) * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 6.4e-12) tmp = cos(im); else tmp = (re + 1.0) + ((re * -0.5) * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 6.4e-12], N[Cos[im], $MachinePrecision], N[(N[(re + 1.0), $MachinePrecision] + N[(N[(re * -0.5), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 6.4 \cdot 10^{-12}:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\left(re + 1\right) + \left(re \cdot -0.5\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if re < 6.4000000000000002e-12Initial program 100.0%
Taylor expanded in re around 0 70.5%
if 6.4000000000000002e-12 < re Initial program 100.0%
Taylor expanded in re around 0 10.3%
*-rgt-identity10.3%
distribute-lft-in10.3%
Simplified10.3%
Taylor expanded in im around 0 36.1%
associate-+r+36.1%
+-commutative36.1%
+-commutative36.1%
*-commutative36.1%
unpow236.1%
Simplified36.1%
Taylor expanded in re around inf 36.1%
unpow236.1%
associate-*r*36.1%
Simplified36.1%
Final simplification63.4%
(FPCore (re im) :precision binary64 (if (<= re 7.2e+24) (+ re 1.0) (* re (+ 1.0 (* im (* im -0.5))))))
double code(double re, double im) {
double tmp;
if (re <= 7.2e+24) {
tmp = re + 1.0;
} else {
tmp = re * (1.0 + (im * (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 <= 7.2d+24) then
tmp = re + 1.0d0
else
tmp = re * (1.0d0 + (im * (im * (-0.5d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 7.2e+24) {
tmp = re + 1.0;
} else {
tmp = re * (1.0 + (im * (im * -0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 7.2e+24: tmp = re + 1.0 else: tmp = re * (1.0 + (im * (im * -0.5))) return tmp
function code(re, im) tmp = 0.0 if (re <= 7.2e+24) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(1.0 + Float64(im * Float64(im * -0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 7.2e+24) tmp = re + 1.0; else tmp = re * (1.0 + (im * (im * -0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 7.2e+24], N[(re + 1.0), $MachinePrecision], N[(re * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 7.2 \cdot 10^{+24}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if re < 7.19999999999999966e24Initial program 100.0%
Taylor expanded in re around 0 70.4%
*-rgt-identity70.4%
distribute-lft-in70.4%
Simplified70.4%
Taylor expanded in im around 0 36.4%
+-commutative36.4%
fma-def36.4%
+-commutative36.4%
*-commutative36.4%
unpow236.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in im around 0 39.5%
if 7.19999999999999966e24 < re Initial program 100.0%
Taylor expanded in re around 0 5.5%
*-rgt-identity5.5%
distribute-lft-in5.5%
Simplified5.5%
Taylor expanded in im around 0 36.4%
associate-+r+36.4%
+-commutative36.4%
+-commutative36.4%
*-commutative36.4%
unpow236.4%
Simplified36.4%
Taylor expanded in re around inf 36.4%
unpow236.4%
associate-*r*36.4%
Simplified36.4%
Taylor expanded in re around inf 36.4%
*-commutative36.4%
unpow236.4%
*-commutative36.4%
associate-*r*36.4%
Simplified36.4%
Final simplification38.9%
(FPCore (re im) :precision binary64 (if (<= re 7.2e+24) (+ re 1.0) (+ 1.0 (* -0.5 (* im im)))))
double code(double re, double im) {
double tmp;
if (re <= 7.2e+24) {
tmp = re + 1.0;
} else {
tmp = 1.0 + (-0.5 * (im * im));
}
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+24) then
tmp = re + 1.0d0
else
tmp = 1.0d0 + ((-0.5d0) * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 7.2e+24) {
tmp = re + 1.0;
} else {
tmp = 1.0 + (-0.5 * (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 7.2e+24: tmp = re + 1.0 else: tmp = 1.0 + (-0.5 * (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= 7.2e+24) tmp = Float64(re + 1.0); else tmp = Float64(1.0 + Float64(-0.5 * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 7.2e+24) tmp = re + 1.0; else tmp = 1.0 + (-0.5 * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 7.2e+24], N[(re + 1.0), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 7.2 \cdot 10^{+24}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if re < 7.19999999999999966e24Initial program 100.0%
Taylor expanded in re around 0 70.4%
*-rgt-identity70.4%
distribute-lft-in70.4%
Simplified70.4%
Taylor expanded in im around 0 36.4%
+-commutative36.4%
fma-def36.4%
+-commutative36.4%
*-commutative36.4%
unpow236.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in im around 0 39.5%
if 7.19999999999999966e24 < re Initial program 100.0%
Taylor expanded in re around 0 5.5%
*-rgt-identity5.5%
distribute-lft-in5.5%
Simplified5.5%
Taylor expanded in im around 0 36.4%
+-commutative36.4%
fma-def36.4%
+-commutative36.4%
*-commutative36.4%
unpow236.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in re around 0 25.7%
unpow225.7%
Simplified25.7%
Final simplification36.9%
(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 58.5%
*-rgt-identity58.5%
distribute-lft-in58.5%
Simplified58.5%
Taylor expanded in im around 0 36.4%
+-commutative36.4%
fma-def36.4%
+-commutative36.4%
*-commutative36.4%
unpow236.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in im around 0 32.9%
Final simplification32.9%
herbie shell --seed 2023194
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))