
(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 19 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) 2.0) (cos im) (exp re))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.0) {
tmp = exp(re);
} else if (exp(re) <= 2.0) {
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) <= 2.0d0) 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) <= 2.0) {
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) <= 2.0: 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) <= 2.0) 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) <= 2.0) 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], 2.0], 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 2:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0 or 2 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6486.2%
Simplified86.2%
if 0.0 < (exp.f64 re) < 2Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6499.1%
Simplified99.1%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos im)
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))))
(if (<= re -0.0235)
(exp re)
(if (<= re 550000000.0)
t_0
(if (<= re 1.05e+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.0235) {
tmp = exp(re);
} else if (re <= 550000000.0) {
tmp = t_0;
} else if (re <= 1.05e+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.0235d0)) then
tmp = exp(re)
else if (re <= 550000000.0d0) then
tmp = t_0
else if (re <= 1.05d+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.0235) {
tmp = Math.exp(re);
} else if (re <= 550000000.0) {
tmp = t_0;
} else if (re <= 1.05e+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.0235: tmp = math.exp(re) elif re <= 550000000.0: tmp = t_0 elif re <= 1.05e+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.0235) tmp = exp(re); elseif (re <= 550000000.0) tmp = t_0; elseif (re <= 1.05e+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.0235) tmp = exp(re); elseif (re <= 550000000.0) tmp = t_0; elseif (re <= 1.05e+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.0235], N[Exp[re], $MachinePrecision], If[LessEqual[re, 550000000.0], t$95$0, If[LessEqual[re, 1.05e+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.0235:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 550000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.05 \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.0235Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -0.0235 < re < 5.5e8 or 1.0500000000000001e103 < 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.4%
Simplified99.4%
if 5.5e8 < re < 1.0500000000000001e103Initial 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-*.f6478.6%
Simplified78.6%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos im) (+ 1.0 (* re (+ 1.0 (* re 0.5)))))))
(if (<= re -0.0065)
(exp re)
(if (<= re 550000000.0)
t_0
(if (<= re 1.9e+154) (* (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))));
double tmp;
if (re <= -0.0065) {
tmp = exp(re);
} else if (re <= 550000000.0) {
tmp = t_0;
} else if (re <= 1.9e+154) {
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))))
if (re <= (-0.0065d0)) then
tmp = exp(re)
else if (re <= 550000000.0d0) then
tmp = t_0
else if (re <= 1.9d+154) 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))));
double tmp;
if (re <= -0.0065) {
tmp = Math.exp(re);
} else if (re <= 550000000.0) {
tmp = t_0;
} else if (re <= 1.9e+154) {
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)))) tmp = 0 if re <= -0.0065: tmp = math.exp(re) elif re <= 550000000.0: tmp = t_0 elif re <= 1.9e+154: 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 * 0.5))))) tmp = 0.0 if (re <= -0.0065) tmp = exp(re); elseif (re <= 550000000.0) tmp = t_0; elseif (re <= 1.9e+154) 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)))); tmp = 0.0; if (re <= -0.0065) tmp = exp(re); elseif (re <= 550000000.0) tmp = t_0; elseif (re <= 1.9e+154) 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 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.0065], N[Exp[re], $MachinePrecision], If[LessEqual[re, 550000000.0], t$95$0, If[LessEqual[re, 1.9e+154], 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 0.5\right)\right)\\
\mathbf{if}\;re \leq -0.0065:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 550000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;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.0064999999999999997Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -0.0064999999999999997 < re < 5.5e8 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.2%
Simplified99.2%
if 5.5e8 < re < 1.8999999999999999e154Initial 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-*.f6485.2%
Simplified85.2%
Final simplification97.9%
(FPCore (re im)
:precision binary64
(if (<= re -0.00035)
(exp re)
(if (<= re 550000000.0)
(* (cos im) (+ re 1.0))
(* (exp re) (+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= -0.00035) {
tmp = exp(re);
} else if (re <= 550000000.0) {
tmp = cos(im) * (re + 1.0);
} else {
tmp = exp(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 <= (-0.00035d0)) then
tmp = exp(re)
else if (re <= 550000000.0d0) then
tmp = cos(im) * (re + 1.0d0)
else
tmp = exp(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 <= -0.00035) {
tmp = Math.exp(re);
} else if (re <= 550000000.0) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re) * (1.0 + (im * (im * -0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.00035: tmp = math.exp(re) elif re <= 550000000.0: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) * (1.0 + (im * (im * -0.5))) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.00035) tmp = exp(re); elseif (re <= 550000000.0) tmp = Float64(cos(im) * Float64(re + 1.0)); else tmp = Float64(exp(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 <= -0.00035) tmp = exp(re); elseif (re <= 550000000.0) tmp = cos(im) * (re + 1.0); else tmp = exp(re) * (1.0 + (im * (im * -0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.00035], N[Exp[re], $MachinePrecision], If[LessEqual[re, 550000000.0], N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.00035:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 550000000:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re} \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if re < -3.49999999999999996e-4Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f64100.0%
Simplified100.0%
if -3.49999999999999996e-4 < re < 5.5e8Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6498.9%
Simplified98.9%
if 5.5e8 < re Initial 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-*.f6481.1%
Simplified81.1%
Final simplification95.5%
(FPCore (re im) :precision binary64 (if (<= re -0.00028) (exp re) (if (<= re 0.00195) (* (cos im) (+ re 1.0)) (exp re))))
double code(double re, double im) {
double tmp;
if (re <= -0.00028) {
tmp = exp(re);
} else if (re <= 0.00195) {
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 <= (-0.00028d0)) then
tmp = exp(re)
else if (re <= 0.00195d0) 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 <= -0.00028) {
tmp = Math.exp(re);
} else if (re <= 0.00195) {
tmp = Math.cos(im) * (re + 1.0);
} else {
tmp = Math.exp(re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -0.00028: tmp = math.exp(re) elif re <= 0.00195: tmp = math.cos(im) * (re + 1.0) else: tmp = math.exp(re) return tmp
function code(re, im) tmp = 0.0 if (re <= -0.00028) tmp = exp(re); elseif (re <= 0.00195) 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 <= -0.00028) tmp = exp(re); elseif (re <= 0.00195) tmp = cos(im) * (re + 1.0); else tmp = exp(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -0.00028], N[Exp[re], $MachinePrecision], If[LessEqual[re, 0.00195], 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 -0.00028:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;re \leq 0.00195:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if re < -2.7999999999999998e-4 or 0.0019499999999999999 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6486.2%
Simplified86.2%
if -2.7999999999999998e-4 < re < 0.0019499999999999999Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6499.6%
Simplified99.6%
Final simplification93.5%
(FPCore (re im)
:precision binary64
(if (<= re -460.0)
(* (+ re 1.0) (* -0.5 (* im im)))
(if (<= re 550000000.0)
(cos im)
(*
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
(+
1.0
(*
(* im im)
(+ -0.5 (* (* im im) (* (* im im) -0.001388888888888889)))))))))
double code(double re, double im) {
double tmp;
if (re <= -460.0) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 550000000.0) {
tmp = cos(im);
} else {
tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + ((im * im) * (-0.5 + ((im * im) * ((im * im) * -0.001388888888888889)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-460.0d0)) then
tmp = (re + 1.0d0) * ((-0.5d0) * (im * im))
else if (re <= 550000000.0d0) then
tmp = cos(im)
else
tmp = (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))) * (1.0d0 + ((im * im) * ((-0.5d0) + ((im * im) * ((im * im) * (-0.001388888888888889d0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -460.0) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 550000000.0) {
tmp = Math.cos(im);
} else {
tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + ((im * im) * (-0.5 + ((im * im) * ((im * im) * -0.001388888888888889)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -460.0: tmp = (re + 1.0) * (-0.5 * (im * im)) elif re <= 550000000.0: tmp = math.cos(im) else: tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + ((im * im) * (-0.5 + ((im * im) * ((im * im) * -0.001388888888888889))))) return tmp
function code(re, im) tmp = 0.0 if (re <= -460.0) tmp = Float64(Float64(re + 1.0) * Float64(-0.5 * Float64(im * im))); elseif (re <= 550000000.0) tmp = cos(im); else tmp = Float64(Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))) * Float64(1.0 + Float64(Float64(im * im) * Float64(-0.5 + Float64(Float64(im * im) * Float64(Float64(im * im) * -0.001388888888888889)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -460.0) tmp = (re + 1.0) * (-0.5 * (im * im)); elseif (re <= 550000000.0) tmp = cos(im); else tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + ((im * im) * (-0.5 + ((im * im) * ((im * im) * -0.001388888888888889))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -460.0], N[(N[(re + 1.0), $MachinePrecision] * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 550000000.0], N[Cos[im], $MachinePrecision], N[(N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.5 + N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -460:\\
\;\;\;\;\left(re + 1\right) \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 550000000:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(-0.5 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot -0.001388888888888889\right)\right)\right)\\
\end{array}
\end{array}
if re < -460Initial 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-*.f6485.5%
Simplified85.5%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6429.2%
Simplified29.2%
if -460 < re < 5.5e8Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6498.4%
Simplified98.4%
if 5.5e8 < 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-*.f6475.0%
Simplified75.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6470.4%
Simplified70.4%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6470.4%
Simplified70.4%
Final simplification75.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666)))))))
(if (<= re -2.5e-27)
(* (+ re 1.0) (* -0.5 (* im im)))
(if (<= re 6.8e-31)
(/ (+ 1.0 (* t_0 (* t_0 t_0))) (+ 1.0 (* t_0 (+ t_0 -1.0))))
(* (+ 1.0 t_0) (+ 1.0 (* im (* im -0.5))))))))
double code(double re, double im) {
double t_0 = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 6.8e-31) {
tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0)));
} else {
tmp = (1.0 + t_0) * (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) :: t_0
real(8) :: tmp
t_0 = re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0))))
if (re <= (-2.5d-27)) then
tmp = (re + 1.0d0) * ((-0.5d0) * (im * im))
else if (re <= 6.8d-31) then
tmp = (1.0d0 + (t_0 * (t_0 * t_0))) / (1.0d0 + (t_0 * (t_0 + (-1.0d0))))
else
tmp = (1.0d0 + t_0) * (1.0d0 + (im * (im * (-0.5d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666))));
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 6.8e-31) {
tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0)));
} else {
tmp = (1.0 + t_0) * (1.0 + (im * (im * -0.5)));
}
return tmp;
}
def code(re, im): t_0 = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))) tmp = 0 if re <= -2.5e-27: tmp = (re + 1.0) * (-0.5 * (im * im)) elif re <= 6.8e-31: tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0))) else: tmp = (1.0 + t_0) * (1.0 + (im * (im * -0.5))) return tmp
function code(re, im) t_0 = Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666))))) tmp = 0.0 if (re <= -2.5e-27) tmp = Float64(Float64(re + 1.0) * Float64(-0.5 * Float64(im * im))); elseif (re <= 6.8e-31) tmp = Float64(Float64(1.0 + Float64(t_0 * Float64(t_0 * t_0))) / Float64(1.0 + Float64(t_0 * Float64(t_0 + -1.0)))); else tmp = Float64(Float64(1.0 + t_0) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))); tmp = 0.0; if (re <= -2.5e-27) tmp = (re + 1.0) * (-0.5 * (im * im)); elseif (re <= 6.8e-31) tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0))); else tmp = (1.0 + t_0) * (1.0 + (im * (im * -0.5))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.5e-27], N[(N[(re + 1.0), $MachinePrecision] * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.8e-31], N[(N[(1.0 + N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$0 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;re \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;\left(re + 1\right) \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 6.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{1 + t\_0 \cdot \left(t\_0 \cdot t\_0\right)}{1 + t\_0 \cdot \left(t\_0 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if re < -2.5000000000000001e-27Initial 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-*.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.7%
Simplified28.7%
if -2.5000000000000001e-27 < re < 6.8000000000000002e-31Initial 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-*.f64100.0%
Simplified100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6456.6%
Simplified56.6%
flip3-+N/A
/-lowering-/.f64N/A
Applied egg-rr56.6%
if 6.8000000000000002e-31 < re Initial 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.9%
Simplified77.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6468.9%
Simplified68.9%
Final simplification52.8%
(FPCore (re im)
:precision binary64
(if (<= re -2.5e-27)
(* (+ re 1.0) (* -0.5 (* im im)))
(if (<= re 6.6e-31)
(+ re 1.0)
(*
(+ 1.0 (* re (+ 1.0 (* re (+ 0.5 (* re 0.16666666666666666))))))
(+ 1.0 (* im (* im -0.5)))))))
double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 6.6e-31) {
tmp = re + 1.0;
} else {
tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (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 <= (-2.5d-27)) then
tmp = (re + 1.0d0) * ((-0.5d0) * (im * im))
else if (re <= 6.6d-31) then
tmp = re + 1.0d0
else
tmp = (1.0d0 + (re * (1.0d0 + (re * (0.5d0 + (re * 0.16666666666666666d0)))))) * (1.0d0 + (im * (im * (-0.5d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 6.6e-31) {
tmp = re + 1.0;
} else {
tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + (im * (im * -0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.5e-27: tmp = (re + 1.0) * (-0.5 * (im * im)) elif re <= 6.6e-31: tmp = re + 1.0 else: tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + (im * (im * -0.5))) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.5e-27) tmp = Float64(Float64(re + 1.0) * Float64(-0.5 * Float64(im * im))); elseif (re <= 6.6e-31) tmp = Float64(re + 1.0); else tmp = Float64(Float64(1.0 + Float64(re * Float64(1.0 + Float64(re * Float64(0.5 + Float64(re * 0.16666666666666666)))))) * Float64(1.0 + Float64(im * Float64(im * -0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.5e-27) tmp = (re + 1.0) * (-0.5 * (im * im)); elseif (re <= 6.6e-31) tmp = re + 1.0; else tmp = (1.0 + (re * (1.0 + (re * (0.5 + (re * 0.16666666666666666)))))) * (1.0 + (im * (im * -0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.5e-27], N[(N[(re + 1.0), $MachinePrecision] * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.6e-31], N[(re + 1.0), $MachinePrecision], N[(N[(1.0 + N[(re * N[(1.0 + N[(re * N[(0.5 + N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;\left(re + 1\right) \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 6.6 \cdot 10^{-31}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re \cdot \left(1 + re \cdot \left(0.5 + re \cdot 0.16666666666666666\right)\right)\right) \cdot \left(1 + im \cdot \left(im \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if re < -2.5000000000000001e-27Initial 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-*.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.7%
Simplified28.7%
if -2.5000000000000001e-27 < re < 6.5999999999999998e-31Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6456.6%
Simplified56.6%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6456.6%
Simplified56.6%
if 6.5999999999999998e-31 < re Initial 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.9%
Simplified77.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6468.9%
Simplified68.9%
Final simplification52.8%
(FPCore (re im)
:precision binary64
(if (<= re -2.5e-27)
(* (+ re 1.0) (* -0.5 (* im im)))
(if (<= re 3.7e-9)
(+ re 1.0)
(if (<= re 2.55e+113)
(* (* re re) (+ 0.5 (* (* im im) -0.25)))
(* re (* re (* re 0.16666666666666666)))))))
double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else if (re <= 2.55e+113) {
tmp = (re * re) * (0.5 + ((im * im) * -0.25));
} else {
tmp = re * (re * (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 <= (-2.5d-27)) then
tmp = (re + 1.0d0) * ((-0.5d0) * (im * im))
else if (re <= 3.7d-9) then
tmp = re + 1.0d0
else if (re <= 2.55d+113) then
tmp = (re * re) * (0.5d0 + ((im * im) * (-0.25d0)))
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else if (re <= 2.55e+113) {
tmp = (re * re) * (0.5 + ((im * im) * -0.25));
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.5e-27: tmp = (re + 1.0) * (-0.5 * (im * im)) elif re <= 3.7e-9: tmp = re + 1.0 elif re <= 2.55e+113: tmp = (re * re) * (0.5 + ((im * im) * -0.25)) else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.5e-27) tmp = Float64(Float64(re + 1.0) * Float64(-0.5 * Float64(im * im))); elseif (re <= 3.7e-9) tmp = Float64(re + 1.0); elseif (re <= 2.55e+113) tmp = Float64(Float64(re * re) * Float64(0.5 + Float64(Float64(im * im) * -0.25))); else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.5e-27) tmp = (re + 1.0) * (-0.5 * (im * im)); elseif (re <= 3.7e-9) tmp = re + 1.0; elseif (re <= 2.55e+113) tmp = (re * re) * (0.5 + ((im * im) * -0.25)); else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.5e-27], N[(N[(re + 1.0), $MachinePrecision] * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3.7e-9], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 2.55e+113], N[(N[(re * re), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;\left(re + 1\right) \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 2.55 \cdot 10^{+113}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -2.5000000000000001e-27Initial 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-*.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.7%
Simplified28.7%
if -2.5000000000000001e-27 < re < 3.7e-9Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6458.1%
Simplified58.1%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6458.1%
Simplified58.1%
if 3.7e-9 < re < 2.54999999999999997e113Initial 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-*.f6467.0%
Simplified67.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-*.f6435.4%
Simplified35.4%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6435.4%
Simplified35.4%
Taylor expanded in re around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
metadata-eval35.1%
Simplified35.1%
if 2.54999999999999997e113 < 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-*.f64100.0%
Simplified100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Taylor expanded in re around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified76.3%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Final simplification51.9%
(FPCore (re im)
:precision binary64
(if (<= re -2.5e-27)
(* (+ re 1.0) (* -0.5 (* im im)))
(if (<= re 3.7e-9)
(+ re 1.0)
(* (+ 1.0 (* im (* im -0.5))) (* re (* 0.16666666666666666 (* re re)))))))
double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else {
tmp = (1.0 + (im * (im * -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 <= (-2.5d-27)) then
tmp = (re + 1.0d0) * ((-0.5d0) * (im * im))
else if (re <= 3.7d-9) then
tmp = re + 1.0d0
else
tmp = (1.0d0 + (im * (im * (-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 <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else {
tmp = (1.0 + (im * (im * -0.5))) * (re * (0.16666666666666666 * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.5e-27: tmp = (re + 1.0) * (-0.5 * (im * im)) elif re <= 3.7e-9: tmp = re + 1.0 else: tmp = (1.0 + (im * (im * -0.5))) * (re * (0.16666666666666666 * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.5e-27) tmp = Float64(Float64(re + 1.0) * Float64(-0.5 * Float64(im * im))); elseif (re <= 3.7e-9) tmp = Float64(re + 1.0); else tmp = Float64(Float64(1.0 + Float64(im * Float64(im * -0.5))) * Float64(re * Float64(0.16666666666666666 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.5e-27) tmp = (re + 1.0) * (-0.5 * (im * im)); elseif (re <= 3.7e-9) tmp = re + 1.0; else tmp = (1.0 + (im * (im * -0.5))) * (re * (0.16666666666666666 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.5e-27], N[(N[(re + 1.0), $MachinePrecision] * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3.7e-9], N[(re + 1.0), $MachinePrecision], N[(N[(1.0 + N[(im * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(re * N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;\left(re + 1\right) \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(1 + im \cdot \left(im \cdot -0.5\right)\right) \cdot \left(re \cdot \left(0.16666666666666666 \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if re < -2.5000000000000001e-27Initial 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-*.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.7%
Simplified28.7%
if -2.5000000000000001e-27 < re < 3.7e-9Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6458.1%
Simplified58.1%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6458.1%
Simplified58.1%
if 3.7e-9 < re Initial 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-*.f6476.9%
Simplified76.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6466.7%
Simplified66.7%
Taylor expanded in re around inf
*-commutativeN/A
cube-multN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6466.7%
Simplified66.7%
Final simplification52.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.5 (* im im))))
(if (<= re -2.5e-27)
(* (+ re 1.0) t_0)
(if (<= re 3.7e-9)
(+ re 1.0)
(if (<= re 2.6e+113)
(* re (+ 1.0 t_0))
(* re (* re (* re 0.16666666666666666))))))))
double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * t_0;
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else if (re <= 2.6e+113) {
tmp = re * (1.0 + t_0);
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
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 = (-0.5d0) * (im * im)
if (re <= (-2.5d-27)) then
tmp = (re + 1.0d0) * t_0
else if (re <= 3.7d-9) then
tmp = re + 1.0d0
else if (re <= 2.6d+113) then
tmp = re * (1.0d0 + t_0)
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.5 * (im * im);
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * t_0;
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else if (re <= 2.6e+113) {
tmp = re * (1.0 + t_0);
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): t_0 = -0.5 * (im * im) tmp = 0 if re <= -2.5e-27: tmp = (re + 1.0) * t_0 elif re <= 3.7e-9: tmp = re + 1.0 elif re <= 2.6e+113: tmp = re * (1.0 + t_0) else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) t_0 = Float64(-0.5 * Float64(im * im)) tmp = 0.0 if (re <= -2.5e-27) tmp = Float64(Float64(re + 1.0) * t_0); elseif (re <= 3.7e-9) tmp = Float64(re + 1.0); elseif (re <= 2.6e+113) tmp = Float64(re * Float64(1.0 + t_0)); else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.5 * (im * im); tmp = 0.0; if (re <= -2.5e-27) tmp = (re + 1.0) * t_0; elseif (re <= 3.7e-9) tmp = re + 1.0; elseif (re <= 2.6e+113) tmp = re * (1.0 + t_0); else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -2.5e-27], N[(N[(re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[re, 3.7e-9], N[(re + 1.0), $MachinePrecision], If[LessEqual[re, 2.6e+113], N[(re * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(im \cdot im\right)\\
\mathbf{if}\;re \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;\left(re + 1\right) \cdot t\_0\\
\mathbf{elif}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;re + 1\\
\mathbf{elif}\;re \leq 2.6 \cdot 10^{+113}:\\
\;\;\;\;re \cdot \left(1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -2.5000000000000001e-27Initial 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-*.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.7%
Simplified28.7%
if -2.5000000000000001e-27 < re < 3.7e-9Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6458.1%
Simplified58.1%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6458.1%
Simplified58.1%
if 3.7e-9 < re < 2.5999999999999999e113Initial 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-*.f6467.0%
Simplified67.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6434.9%
Simplified34.9%
Taylor expanded in re around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6434.9%
Simplified34.9%
if 2.5999999999999999e113 < 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-*.f64100.0%
Simplified100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Taylor expanded in re around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified76.3%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Final simplification51.9%
(FPCore (re im)
:precision binary64
(if (<= re -2.5e-27)
(* (+ re 1.0) (* -0.5 (* im im)))
(if (<= re 3.7e-9)
(+ re 1.0)
(*
(* re re)
(* re (+ 0.16666666666666666 (* (* im im) -0.08333333333333333)))))))
double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else {
tmp = (re * re) * (re * (0.16666666666666666 + ((im * im) * -0.08333333333333333)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-2.5d-27)) then
tmp = (re + 1.0d0) * ((-0.5d0) * (im * im))
else if (re <= 3.7d-9) then
tmp = re + 1.0d0
else
tmp = (re * re) * (re * (0.16666666666666666d0 + ((im * im) * (-0.08333333333333333d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -2.5e-27) {
tmp = (re + 1.0) * (-0.5 * (im * im));
} else if (re <= 3.7e-9) {
tmp = re + 1.0;
} else {
tmp = (re * re) * (re * (0.16666666666666666 + ((im * im) * -0.08333333333333333)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -2.5e-27: tmp = (re + 1.0) * (-0.5 * (im * im)) elif re <= 3.7e-9: tmp = re + 1.0 else: tmp = (re * re) * (re * (0.16666666666666666 + ((im * im) * -0.08333333333333333))) return tmp
function code(re, im) tmp = 0.0 if (re <= -2.5e-27) tmp = Float64(Float64(re + 1.0) * Float64(-0.5 * Float64(im * im))); elseif (re <= 3.7e-9) tmp = Float64(re + 1.0); else tmp = Float64(Float64(re * re) * Float64(re * Float64(0.16666666666666666 + Float64(Float64(im * im) * -0.08333333333333333)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -2.5e-27) tmp = (re + 1.0) * (-0.5 * (im * im)); elseif (re <= 3.7e-9) tmp = re + 1.0; else tmp = (re * re) * (re * (0.16666666666666666 + ((im * im) * -0.08333333333333333))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -2.5e-27], N[(N[(re + 1.0), $MachinePrecision] * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3.7e-9], N[(re + 1.0), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * N[(re * N[(0.16666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;\left(re + 1\right) \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(re \cdot \left(0.16666666666666666 + \left(im \cdot im\right) \cdot -0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if re < -2.5000000000000001e-27Initial 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-*.f6484.2%
Simplified84.2%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f642.0%
Simplified2.0%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6428.7%
Simplified28.7%
if -2.5000000000000001e-27 < re < 3.7e-9Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6458.1%
Simplified58.1%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6458.1%
Simplified58.1%
if 3.7e-9 < re Initial 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-*.f6476.9%
Simplified76.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6466.7%
Simplified66.7%
Taylor expanded in re around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow3N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
metadata-evalN/A
Simplified66.7%
Final simplification52.7%
(FPCore (re im)
:precision binary64
(if (<= re 3.7e-9)
1.0
(if (<= re 2.55e+113)
(* re (+ 1.0 (* -0.5 (* im im))))
(* re (* re (* re 0.16666666666666666))))))
double code(double re, double im) {
double tmp;
if (re <= 3.7e-9) {
tmp = 1.0;
} else if (re <= 2.55e+113) {
tmp = re * (1.0 + (-0.5 * (im * im)));
} else {
tmp = re * (re * (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 <= 3.7d-9) then
tmp = 1.0d0
else if (re <= 2.55d+113) then
tmp = re * (1.0d0 + ((-0.5d0) * (im * im)))
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 3.7e-9) {
tmp = 1.0;
} else if (re <= 2.55e+113) {
tmp = re * (1.0 + (-0.5 * (im * im)));
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.7e-9: tmp = 1.0 elif re <= 2.55e+113: tmp = re * (1.0 + (-0.5 * (im * im))) else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) tmp = 0.0 if (re <= 3.7e-9) tmp = 1.0; elseif (re <= 2.55e+113) tmp = Float64(re * Float64(1.0 + Float64(-0.5 * Float64(im * im)))); else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 3.7e-9) tmp = 1.0; elseif (re <= 2.55e+113) tmp = re * (1.0 + (-0.5 * (im * im))); else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.7e-9], 1.0, If[LessEqual[re, 2.55e+113], N[(re * N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{elif}\;re \leq 2.55 \cdot 10^{+113}:\\
\;\;\;\;re \cdot \left(1 + -0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < 3.7e-9Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6469.9%
Simplified69.9%
Taylor expanded in im around 0
Simplified40.6%
if 3.7e-9 < re < 2.54999999999999997e113Initial 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-*.f6467.0%
Simplified67.0%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6434.9%
Simplified34.9%
Taylor expanded in re around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6434.9%
Simplified34.9%
if 2.54999999999999997e113 < 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-*.f64100.0%
Simplified100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Taylor expanded in re around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified76.3%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Final simplification45.5%
(FPCore (re im)
:precision binary64
(if (<= re 6.8e-31)
1.0
(if (<= re 2.55e+113)
(+ 1.0 (* -0.5 (* im im)))
(* re (* re (* re 0.16666666666666666))))))
double code(double re, double im) {
double tmp;
if (re <= 6.8e-31) {
tmp = 1.0;
} else if (re <= 2.55e+113) {
tmp = 1.0 + (-0.5 * (im * im));
} else {
tmp = re * (re * (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 <= 6.8d-31) then
tmp = 1.0d0
else if (re <= 2.55d+113) then
tmp = 1.0d0 + ((-0.5d0) * (im * im))
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 6.8e-31) {
tmp = 1.0;
} else if (re <= 2.55e+113) {
tmp = 1.0 + (-0.5 * (im * im));
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 6.8e-31: tmp = 1.0 elif re <= 2.55e+113: tmp = 1.0 + (-0.5 * (im * im)) else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) tmp = 0.0 if (re <= 6.8e-31) tmp = 1.0; elseif (re <= 2.55e+113) tmp = Float64(1.0 + Float64(-0.5 * Float64(im * im))); else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 6.8e-31) tmp = 1.0; elseif (re <= 2.55e+113) tmp = 1.0 + (-0.5 * (im * im)); else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 6.8e-31], 1.0, If[LessEqual[re, 2.55e+113], N[(1.0 + N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 6.8 \cdot 10^{-31}:\\
\;\;\;\;1\\
\mathbf{elif}\;re \leq 2.55 \cdot 10^{+113}:\\
\;\;\;\;1 + -0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < 6.8000000000000002e-31Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6468.9%
Simplified68.9%
Taylor expanded in im around 0
Simplified39.1%
if 6.8000000000000002e-31 < re < 2.54999999999999997e113Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6432.9%
Simplified32.9%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6444.7%
Simplified44.7%
if 2.54999999999999997e113 < 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-*.f64100.0%
Simplified100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
Taylor expanded in re around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified76.3%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.3%
Simplified76.3%
(FPCore (re im) :precision binary64 (if (<= re 3.7e-9) 1.0 (* re (* re (* re 0.16666666666666666)))))
double code(double re, double im) {
double tmp;
if (re <= 3.7e-9) {
tmp = 1.0;
} else {
tmp = re * (re * (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 <= 3.7d-9) then
tmp = 1.0d0
else
tmp = re * (re * (re * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 3.7e-9) {
tmp = 1.0;
} else {
tmp = re * (re * (re * 0.16666666666666666));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.7e-9: tmp = 1.0 else: tmp = re * (re * (re * 0.16666666666666666)) return tmp
function code(re, im) tmp = 0.0 if (re <= 3.7e-9) tmp = 1.0; else tmp = Float64(re * Float64(re * Float64(re * 0.16666666666666666))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 3.7e-9) tmp = 1.0; else tmp = re * (re * (re * 0.16666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.7e-9], 1.0, N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < 3.7e-9Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6469.9%
Simplified69.9%
Taylor expanded in im around 0
Simplified40.6%
if 3.7e-9 < 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-*.f6474.3%
Simplified74.3%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6452.7%
Simplified52.7%
Taylor expanded in re around -inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified52.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6452.7%
Simplified52.7%
(FPCore (re im) :precision binary64 (if (<= re 3.7e-9) 1.0 (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if (re <= 3.7e-9) {
tmp = 1.0;
} else {
tmp = 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 <= 3.7d-9) then
tmp = 1.0d0
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 3.7e-9) {
tmp = 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 3.7e-9: tmp = 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (re <= 3.7e-9) tmp = 1.0; else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 3.7e-9) tmp = 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 3.7e-9], 1.0, N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if re < 3.7e-9Initial program 100.0%
Taylor expanded in re around 0
cos-lowering-cos.f6469.9%
Simplified69.9%
Taylor expanded in im around 0
Simplified40.6%
if 3.7e-9 < re Initial program 100.0%
Taylor expanded in im around 0
exp-lowering-exp.f6467.9%
Simplified67.9%
Taylor expanded in re around 0
rgt-mult-inverseN/A
*-rgt-identityN/A
rgt-mult-inverseN/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate-*l*N/A
unpow2N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
*-commutativeN/A
Simplified36.1%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6436.1%
Simplified36.1%
(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
+-commutativeN/A
+-lowering-+.f6432.5%
Simplified32.5%
(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 re around 0
cos-lowering-cos.f6455.6%
Simplified55.6%
Taylor expanded in im around 0
Simplified32.3%
herbie shell --seed 2024186
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))