
(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 17 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%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.0) (exp re) (if (<= (exp re) 1.005) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.0) {
tmp = exp(re);
} else if (exp(re) <= 1.005) {
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 (exp(re) <= 0.0d0) then
tmp = exp(re)
else if (exp(re) <= 1.005d0) 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 (Math.exp(re) <= 0.0) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.005) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.0: tmp = math.exp(re) elif math.exp(re) <= 1.005: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.0) tmp = exp(re); elseif (exp(re) <= 1.005) 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 (exp(re) <= 0.0) tmp = exp(re); elseif (exp(re) <= 1.005) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.005], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1.005:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0 or 1.0049999999999999 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6488.9%
Simplified88.9%
if 0.0 < (exp.f64 re) < 1.0049999999999999Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6499.0%
Simplified99.0%
Final simplification94.0%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.0) (exp re) (if (<= (exp re) 1.000000001) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.0) {
tmp = exp(re);
} else if (exp(re) <= 1.000000001) {
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.0d0) then
tmp = exp(re)
else if (exp(re) <= 1.000000001d0) 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.0) {
tmp = Math.exp(re);
} else if (Math.exp(re) <= 1.000000001) {
tmp = Math.cos(im);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if math.exp(re) <= 0.0: tmp = math.exp(re) elif math.exp(re) <= 1.000000001: tmp = math.cos(im) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (exp(re) <= 0.0) tmp = exp(re); elseif (exp(re) <= 1.000000001) tmp = cos(im); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (exp(re) <= 0.0) tmp = exp(re); elseif (exp(re) <= 1.000000001) tmp = cos(im); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.000000001], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;e^{re} \leq 1.000000001:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0 or 1.0000000010000001 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6488.0%
Simplified88.0%
if 0.0 < (exp.f64 re) < 1.0000000010000001Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6498.8%
Simplified98.8%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos im)
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
(if (<= re -0.039)
(exp re)
(if (<= re 0.004)
t_0
(if (<= re 1.02e+103) (* (exp re) (+ 1.0 (* im (* im -0.5)))) t_0)))))
double code(double re, double im) {
double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
double tmp;
if (re <= -0.039) {
tmp = exp(re);
} else if (re <= 0.004) {
tmp = t_0;
} else if (re <= 1.02e+103) {
tmp = exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(im) * (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))))
if (re <= (-0.039d0)) then
tmp = exp(re)
else if (re <= 0.004d0) then
tmp = t_0
else if (re <= 1.02d+103) then
tmp = exp(re) * (1.0d0 + (im * (im * (-0.5d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))));
double tmp;
if (re <= -0.039) {
tmp = Math.exp(re);
} else if (re <= 0.004) {
tmp = t_0;
} else if (re <= 1.02e+103) {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) tmp = 0 if re <= -0.039: tmp = math.exp(re) elif re <= 0.004: tmp = t_0 elif re <= 1.02e+103: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))))) tmp = 0.0 if (re <= -0.039) tmp = exp(re); elseif (re <= 0.004) tmp = t_0; elseif (re <= 1.02e+103) tmp = Float64(exp(re) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(im) * (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))); tmp = 0.0; if (re <= -0.039) tmp = exp(re); elseif (re <= 0.004) tmp = t_0; elseif (re <= 1.02e+103) tmp = exp(re) * (1.0 + (im * (im * -0.5))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.039], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.004], t$95$0, If[LessEqual[re, 1.02e+103], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;re \leq -0.039:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.004:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.0389999999999999999Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -0.0389999999999999999 < re < 0.0040000000000000001 or 1.01999999999999991e103 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.9%
Simplified99.9%
if 0.0040000000000000001 < re < 1.01999999999999991e103Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6480.0%
Simplified80.0%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
(if (<= re -0.028)
(exp re)
(if (<= re 0.0037) t_0 (if (<= re 1.9e+154) (exp re) t_0)))))
double code(double re, double im) {
double t_0 = cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
double tmp;
if (re <= -0.028) {
tmp = exp(re);
} else if (re <= 0.0037) {
tmp = t_0;
} else if (re <= 1.9e+154) {
tmp = exp(re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(im) * (1.0d0 + (re * (1.0d0 + (re * 0.5d0))))
if (re <= (-0.028d0)) then
tmp = exp(re)
else if (re <= 0.0037d0) then
tmp = t_0
else if (re <= 1.9d+154) then
tmp = exp(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5))));
double tmp;
if (re <= -0.028) {
tmp = Math.exp(re);
} else if (re <= 0.0037) {
tmp = t_0;
} else if (re <= 1.9e+154) {
tmp = Math.exp(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(im) * (1.0 + (re * (1.0 + (re * 0.5)))) tmp = 0 if re <= -0.028: tmp = math.exp(re) elif re <= 0.0037: tmp = t_0 elif re <= 1.9e+154: tmp = math.exp(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(im) * Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5))))) tmp = 0.0 if (re <= -0.028) tmp = exp(re); elseif (re <= 0.0037) tmp = t_0; elseif (re <= 1.9e+154) tmp = exp(re); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(im) * (1.0 + (re * (1.0 + (re * 0.5)))); tmp = 0.0; if (re <= -0.028) tmp = exp(re); elseif (re <= 0.0037) tmp = t_0; elseif (re <= 1.9e+154) tmp = exp(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[im], $MachinePrecision] * N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.028], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0037], t$95$0, If[LessEqual[re, 1.9e+154], N[Exp[re], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos im \cdot \left(1 + re \cdot \left(1 + re \cdot 0.5\right)\right)\\
\mathbf{if}\;re \leq -0.028:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0037:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < -0.0280000000000000006 or 0.0037000000000000002 < re < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6492.7%
Simplified92.7%
if -0.0280000000000000006 < re < 0.0037000000000000002 or 1.8999999999999999e154 < re Initial program 100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.6%
Simplified99.6%
Final simplification97.0%
(FPCore (re im) :precision binary64 (if (<= re -0.0028) (exp re) (if (<= re 0.0013) (* (cos im) (/ 1.0 (- 1.0 re))) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.0028) {
tmp = exp(re);
} else if (re <= 0.0013) {
tmp = cos(im) * (1.0 / (1.0 - re));
} 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 <= (-0.0028d0)) then
tmp = exp(re)
else if (re <= 0.0013d0) then
tmp = cos(im) * (1.0d0 / (1.0d0 - re))
else
tmp = exp(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -0.0028) {
tmp = Math.exp(re);
} else if (re <= 0.0013) {
tmp = Math.cos(im) * (1.0 / (1.0 - re));
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.0028: tmp = math.exp(re) elif re <= 0.0013: tmp = math.cos(im) * (1.0 / (1.0 - re)) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.0028) tmp = exp(re); elseif (re <= 0.0013) tmp = Float64(cos(im) * Float64(1.0 / Float64(1.0 - re))); else tmp = exp(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -0.0028) tmp = exp(re); elseif (re <= 0.0013) tmp = cos(im) * (1.0 / (1.0 - re)); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.0028], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.0013], N[(N[Cos[im], $MachinePrecision] * N[(1.0 / N[(1.0 - re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.0028:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.0013:\\
\;\;\;\;\cos im \cdot \frac{1}{1 - re}\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -0.00279999999999999997 or 0.0012999999999999999 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6488.9%
Simplified88.9%
if -0.00279999999999999997 < re < 0.0012999999999999999Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6499.0%
Simplified99.0%
+-commutativeN/A
flip-+N/A
metadata-evalN/A
*-rgt-identityN/A
/-lowering-/.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
*-rgt-identityN/A
--lowering--.f6499.0%
Applied egg-rr99.0%
Taylor expanded in re around 0
Simplified99.0%
Final simplification94.0%
(FPCore (re im)
:precision binary64
(if (<= re -175000.0)
(* (* -0.5 (* im im)) (+ re 1.0))
(if (<= re 1e-9)
(cos im)
(+
1.0
(*
re
(+
1.0
(*
re
(/ (+ 0.125 (* (* re (* re re)) 0.004629629629629629)) 0.25))))))))
double code(double re, double im) {
double tmp;
if (re <= -175000.0) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 1e-9) {
tmp = cos(im);
} else {
tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-175000.0d0)) then
tmp = ((-0.5d0) * (im * im)) * (re + 1.0d0)
else if (re <= 1d-9) then
tmp = cos(im)
else
tmp = 1.0d0 + (re * (1.0d0 + (re * ((0.125d0 + ((re * (re * re)) * 0.004629629629629629d0)) / 0.25d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -175000.0) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 1e-9) {
tmp = Math.cos(im);
} else {
tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -175000.0: tmp = (-0.5 * (im * im)) * (re + 1.0) elif re <= 1e-9: tmp = math.cos(im) else: tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -175000.0) tmp = Float64(Float64(-0.5 * Float64(im * im)) * Float64(re + 1.0)); elseif (re <= 1e-9) tmp = cos(im); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(Float64(0.125 + Float64(Float64(re * Float64(re * re)) * 0.004629629629629629)) / 0.25))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -175000.0) tmp = (-0.5 * (im * im)) * (re + 1.0); elseif (re <= 1e-9) tmp = cos(im); else tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -175000.0], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e-9], N[Cos[im], $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(N[(0.125 + N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629), $MachinePrecision]), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -175000:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 10^{-9}:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \frac{0.125 + \left(re \cdot \left(re \cdot re\right)\right) \cdot 0.004629629629629629}{0.25}\right)\\
\end{array}
\end{array}
if re < -175000Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6477.8%
Simplified77.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f641.7%
Simplified1.7%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6430.5%
Simplified30.5%
if -175000 < re < 1.00000000000000006e-9Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6496.6%
Simplified96.6%
if 1.00000000000000006e-9 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6475.6%
Simplified75.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6454.5%
Simplified54.5%
+-commutativeN/A
flip3-+N/A
+-commutativeN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow-prod-downN/A
*-lowering-*.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
swap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
*-commutativeN/A
sub-negN/A
+-lowering-+.f64N/A
metadata-evalN/A
*-commutativeN/A
Applied egg-rr18.6%
Taylor expanded in re around 0
Simplified66.0%
Final simplification72.7%
(FPCore (re im)
:precision binary64
(if (<= re -4.5e-12)
(* (* -0.5 (* im im)) (+ re 1.0))
(+
1.0
(*
re
(+
1.0
(* re (/ (+ 0.125 (* (* re (* re re)) 0.004629629629629629)) 0.25)))))))
double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else {
tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-4.5d-12)) then
tmp = ((-0.5d0) * (im * im)) * (re + 1.0d0)
else
tmp = 1.0d0 + (re * (1.0d0 + (re * ((0.125d0 + ((re * (re * re)) * 0.004629629629629629d0)) / 0.25d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else {
tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.5e-12: tmp = (-0.5 * (im * im)) * (re + 1.0) else: tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.5e-12) tmp = Float64(Float64(-0.5 * Float64(im * im)) * Float64(re + 1.0)); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(Float64(0.125 + Float64(Float64(re * Float64(re * re)) * 0.004629629629629629)) / 0.25))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.5e-12) tmp = (-0.5 * (im * im)) * (re + 1.0); else tmp = 1.0 + (re * (1.0 + (re * ((0.125 + ((re * (re * re)) * 0.004629629629629629)) / 0.25)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.5e-12], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(N[(0.125 + N[(N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision] * 0.004629629629629629), $MachinePrecision]), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.5 \cdot 10^{-12}:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \frac{0.125 + \left(re \cdot \left(re \cdot re\right)\right) \cdot 0.004629629629629629}{0.25}\right)\\
\end{array}
\end{array}
if re < -4.49999999999999981e-12Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.1%
Simplified75.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f641.8%
Simplified1.8%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.1%
Simplified2.1%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.5%
Simplified28.5%
if -4.49999999999999981e-12 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6460.5%
Simplified60.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.3%
Simplified53.3%
+-commutativeN/A
flip3-+N/A
+-commutativeN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow-prod-downN/A
*-lowering-*.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
+-lowering-+.f64N/A
swap-sqrN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
*-commutativeN/A
sub-negN/A
+-lowering-+.f64N/A
metadata-evalN/A
*-commutativeN/A
Applied egg-rr41.1%
Taylor expanded in re around 0
Simplified57.2%
Final simplification49.6%
(FPCore (re im)
:precision binary64
(if (<= re -4.5e-12)
(* (* -0.5 (* im im)) (+ re 1.0))
(if (<= re 1.8)
(+ 1.0 (* re (+ 1.0 (* re 0.5))))
(* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 1.8) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = re * (1.0 + (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 <= (-4.5d-12)) then
tmp = ((-0.5d0) * (im * im)) * (re + 1.0d0)
else if (re <= 1.8d0) then
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
else
tmp = re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 1.8) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.5e-12: tmp = (-0.5 * (im * im)) * (re + 1.0) elif re <= 1.8: tmp = 1.0 + (re * (1.0 + (re * 0.5))) else: tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.5e-12) tmp = Float64(Float64(-0.5 * Float64(im * im)) * Float64(re + 1.0)); elseif (re <= 1.8) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); else tmp = Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.5e-12) tmp = (-0.5 * (im * im)) * (re + 1.0); elseif (re <= 1.8) tmp = 1.0 + (re * (1.0 + (re * 0.5))); else tmp = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.5e-12], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.8], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.5 \cdot 10^{-12}:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.8:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -4.49999999999999981e-12Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.1%
Simplified75.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f641.8%
Simplified1.8%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.1%
Simplified2.1%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.5%
Simplified28.5%
if -4.49999999999999981e-12 < re < 1.80000000000000004Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6453.3%
Simplified53.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6452.9%
Simplified52.9%
if 1.80000000000000004 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.3%
Simplified76.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
+-commutativeN/A
Simplified53.9%
Final simplification46.7%
(FPCore (re im)
:precision binary64
(if (<= re -4.5e-12)
(* (* -0.5 (* im im)) (+ re 1.0))
(if (<= re 2.9)
(+ 1.0 (* re (+ 1.0 (* re 0.5))))
(* (+ 0.5 (* re 0.16666666666666666)) (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 2.9) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * 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.5d-12)) then
tmp = ((-0.5d0) * (im * im)) * (re + 1.0d0)
else if (re <= 2.9d0) then
tmp = 1.0d0 + (re * (1.0d0 + (re * 0.5d0)))
else
tmp = (0.5d0 + (re * 0.16666666666666666d0)) * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 2.9) {
tmp = 1.0 + (re * (1.0 + (re * 0.5)));
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.5e-12: tmp = (-0.5 * (im * im)) * (re + 1.0) elif re <= 2.9: tmp = 1.0 + (re * (1.0 + (re * 0.5))) else: tmp = (0.5 + (re * 0.16666666666666666)) * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.5e-12) tmp = Float64(Float64(-0.5 * Float64(im * im)) * Float64(re + 1.0)); elseif (re <= 2.9) tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * 0.5)))); else tmp = Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.5e-12) tmp = (-0.5 * (im * im)) * (re + 1.0); elseif (re <= 2.9) tmp = 1.0 + (re * (1.0 + (re * 0.5))); else tmp = (0.5 + (re * 0.16666666666666666)) * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.5e-12], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.9], N[(1.0 + N[(re * N[(1.0 + N[(re * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.5 \cdot 10^{-12}:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 2.9:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < -4.49999999999999981e-12Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.1%
Simplified75.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f641.8%
Simplified1.8%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.1%
Simplified2.1%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.5%
Simplified28.5%
if -4.49999999999999981e-12 < re < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6453.3%
Simplified53.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6452.9%
Simplified52.9%
if 2.89999999999999991 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.3%
Simplified76.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Final simplification46.7%
(FPCore (re im)
:precision binary64
(if (<= re -4.5e-12)
(* (* -0.5 (* im im)) (+ re 1.0))
(if (<= re 1.9)
(+ re 1.0)
(* (+ 0.5 (* re 0.16666666666666666)) (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 1.9) {
tmp = re + 1.0;
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * 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.5d-12)) then
tmp = ((-0.5d0) * (im * im)) * (re + 1.0d0)
else if (re <= 1.9d0) then
tmp = re + 1.0d0
else
tmp = (0.5d0 + (re * 0.16666666666666666d0)) * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else if (re <= 1.9) {
tmp = re + 1.0;
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.5e-12: tmp = (-0.5 * (im * im)) * (re + 1.0) elif re <= 1.9: tmp = re + 1.0 else: tmp = (0.5 + (re * 0.16666666666666666)) * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.5e-12) tmp = Float64(Float64(-0.5 * Float64(im * im)) * Float64(re + 1.0)); elseif (re <= 1.9) tmp = Float64(re + 1.0); else tmp = Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.5e-12) tmp = (-0.5 * (im * im)) * (re + 1.0); elseif (re <= 1.9) tmp = re + 1.0; else tmp = (0.5 + (re * 0.16666666666666666)) * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.5e-12], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.9], N[(re + 1.0), $MachinePrecision], N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.5 \cdot 10^{-12}:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\mathbf{elif}\;re \leq 1.9:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < -4.49999999999999981e-12Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.1%
Simplified75.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f641.8%
Simplified1.8%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.1%
Simplified2.1%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.5%
Simplified28.5%
if -4.49999999999999981e-12 < re < 1.8999999999999999Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6453.3%
Simplified53.3%
Taylor expanded in re around 0
+-lowering-+.f6452.8%
Simplified52.8%
if 1.8999999999999999 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.3%
Simplified76.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Final simplification46.6%
(FPCore (re im) :precision binary64 (if (<= re -4.5e-12) (* (* -0.5 (* im im)) (+ re 1.0)) (+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))))
double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else {
tmp = 1.0 + (re * (1.0 + (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 <= (-4.5d-12)) then
tmp = ((-0.5d0) * (im * im)) * (re + 1.0d0)
else
tmp = 1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.5e-12) {
tmp = (-0.5 * (im * im)) * (re + 1.0);
} else {
tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.5e-12: tmp = (-0.5 * (im * im)) * (re + 1.0) else: tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))) return tmp
function code(re, im) tmp = 0.0 if (re <= -4.5e-12) tmp = Float64(Float64(-0.5 * Float64(im * im)) * Float64(re + 1.0)); else tmp = Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.5e-12) tmp = (-0.5 * (im * im)) * (re + 1.0); else tmp = 1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.5e-12], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.5 \cdot 10^{-12}:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -4.49999999999999981e-12Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
*-lft-identityN/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6475.1%
Simplified75.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f641.8%
Simplified1.8%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.1%
Simplified2.1%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.5%
Simplified28.5%
if -4.49999999999999981e-12 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6460.5%
Simplified60.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.3%
Simplified53.3%
Final simplification46.7%
(FPCore (re im) :precision binary64 (if (<= re 1.9) (+ re 1.0) (* (+ 0.5 (* re 0.16666666666666666)) (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 1.9) {
tmp = re + 1.0;
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.9d0) then
tmp = re + 1.0d0
else
tmp = (0.5d0 + (re * 0.16666666666666666d0)) * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.9) {
tmp = re + 1.0;
} else {
tmp = (0.5 + (re * 0.16666666666666666)) * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.9: tmp = re + 1.0 else: tmp = (0.5 + (re * 0.16666666666666666)) * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.9) tmp = Float64(re + 1.0); else tmp = Float64(Float64(0.5 + Float64(re * 0.16666666666666666)) * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.9) tmp = re + 1.0; else tmp = (0.5 + (re * 0.16666666666666666)) * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.9], N[(re + 1.0), $MachinePrecision], N[(N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.9:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot 0.16666666666666666\right) \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 1.8999999999999999Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6468.4%
Simplified68.4%
Taylor expanded in re around 0
+-lowering-+.f6435.4%
Simplified35.4%
if 1.8999999999999999 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.3%
Simplified76.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Final simplification39.6%
(FPCore (re im) :precision binary64 (if (<= re 2.9) (+ re 1.0) (* re (* 0.16666666666666666 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 2.9) {
tmp = re + 1.0;
} else {
tmp = re * (0.16666666666666666 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.9d0) then
tmp = re + 1.0d0
else
tmp = re * (0.16666666666666666d0 * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.9) {
tmp = re + 1.0;
} else {
tmp = re * (0.16666666666666666 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.9: tmp = re + 1.0 else: tmp = re * (0.16666666666666666 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.9) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(0.16666666666666666 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.9) tmp = re + 1.0; else tmp = re * (0.16666666666666666 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.9], N[(re + 1.0), $MachinePrecision], N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.9:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6468.4%
Simplified68.4%
Taylor expanded in re around 0
+-lowering-+.f6435.4%
Simplified35.4%
if 2.89999999999999991 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.3%
Simplified76.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6453.9%
Simplified53.9%
Taylor expanded in re around inf
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.9%
Simplified53.9%
Final simplification39.6%
(FPCore (re im) :precision binary64 (if (<= re 2.8) (+ re 1.0) (* 0.5 (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 2.8) {
tmp = re + 1.0;
} else {
tmp = 0.5 * (re * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.8d0) then
tmp = re + 1.0d0
else
tmp = 0.5d0 * (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.8) {
tmp = re + 1.0;
} else {
tmp = 0.5 * (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.8: tmp = re + 1.0 else: tmp = 0.5 * (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.8) tmp = Float64(re + 1.0); else tmp = Float64(0.5 * Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.8) tmp = re + 1.0; else tmp = 0.5 * (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.8], N[(re + 1.0), $MachinePrecision], N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.8:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 2.7999999999999998Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6468.4%
Simplified68.4%
Taylor expanded in re around 0
+-lowering-+.f6435.4%
Simplified35.4%
if 2.7999999999999998 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6476.3%
Simplified76.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6441.2%
Simplified41.2%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6441.2%
Simplified41.2%
Final simplification36.7%
(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 im around 0
exp-lowering-exp.f6470.2%
Simplified70.2%
Taylor expanded in re around 0
+-lowering-+.f6428.3%
Simplified28.3%
Final simplification28.3%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6470.2%
Simplified70.2%
Taylor expanded in re around 0
Simplified27.6%
herbie shell --seed 2024192
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))