
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Initial program 100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666)))))))
(if (<= im 0.4)
(*
(* 0.5 (cos re))
(+
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))
(+ 1.0 t_0)))
(if (<= im 6.5e+99)
(* 0.5 (+ (exp (- im)) (exp im)))
(* 0.5 (* (cos re) (- (+ t_0 2.0) im)))))))
double code(double re, double im) {
double t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double tmp;
if (im <= 0.4) {
tmp = (0.5 * cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0));
} else if (im <= 6.5e+99) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.5 * (cos(re) * ((t_0 + 2.0) - im));
}
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 = im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))
if (im <= 0.4d0) then
tmp = (0.5d0 * cos(re)) * ((1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))) + (1.0d0 + t_0))
else if (im <= 6.5d+99) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.5d0 * (cos(re) * ((t_0 + 2.0d0) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double tmp;
if (im <= 0.4) {
tmp = (0.5 * Math.cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0));
} else if (im <= 6.5e+99) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.5 * (Math.cos(re) * ((t_0 + 2.0) - im));
}
return tmp;
}
def code(re, im): t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))) tmp = 0 if im <= 0.4: tmp = (0.5 * math.cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0)) elif im <= 6.5e+99: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.5 * (math.cos(re) * ((t_0 + 2.0) - im)) return tmp
function code(re, im) t_0 = Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) tmp = 0.0 if (im <= 0.4) tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) + Float64(1.0 + t_0))); elseif (im <= 6.5e+99) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(t_0 + 2.0) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))); tmp = 0.0; if (im <= 0.4) tmp = (0.5 * cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0)); elseif (im <= 6.5e+99) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.5 * (cos(re) * ((t_0 + 2.0) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.4], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(t$95$0 + 2.0), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;im \leq 0.4:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(\left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right) + \left(1 + t\_0\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(t\_0 + 2\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 0.40000000000000002Initial program 100.0%
Taylor expanded in im around 0 87.4%
Taylor expanded in im around 0 63.5%
*-commutative63.5%
Simplified63.5%
if 0.40000000000000002 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in re around 0 77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.2%
*-commutative0.1%
Simplified96.2%
Taylor expanded in re around inf 96.2%
Final simplification70.4%
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp im) (- 1.0 im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(im) + (1.0 - im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(im) + (1.0d0 - im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(im) + (1.0 - im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(im) + (1.0 - im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(im) + Float64(1.0 - im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(im) + (1.0 - im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[im], $MachinePrecision] + N[(1.0 - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{im} + \left(1 - im\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 73.8%
neg-mul-173.8%
unsub-neg73.8%
Simplified73.8%
Final simplification73.8%
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp im) 1.0)))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(im) + 1.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(im) + 1.0d0)
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(im) + 1.0);
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(im) + 1.0)
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(im) + 1.0)) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(im) + 1.0); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[im], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{im} + 1\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 73.8%
neg-mul-173.8%
unsub-neg73.8%
Simplified73.8%
Taylor expanded in im around 0 72.9%
Final simplification72.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666)))))))
(if (<= im 4.3)
(*
(* 0.5 (cos re))
(+
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))
(+ 1.0 t_0)))
(if (<= im 6.5e+99)
(+ 0.5 (* 0.5 (exp im)))
(* 0.5 (* (cos re) (- (+ t_0 2.0) im)))))))
double code(double re, double im) {
double t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double tmp;
if (im <= 4.3) {
tmp = (0.5 * cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = 0.5 * (cos(re) * ((t_0 + 2.0) - im));
}
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 = im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))
if (im <= 4.3d0) then
tmp = (0.5d0 * cos(re)) * ((1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))) + (1.0d0 + t_0))
else if (im <= 6.5d+99) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = 0.5d0 * (cos(re) * ((t_0 + 2.0d0) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double tmp;
if (im <= 4.3) {
tmp = (0.5 * Math.cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = 0.5 * (Math.cos(re) * ((t_0 + 2.0) - im));
}
return tmp;
}
def code(re, im): t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))) tmp = 0 if im <= 4.3: tmp = (0.5 * math.cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0)) elif im <= 6.5e+99: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = 0.5 * (math.cos(re) * ((t_0 + 2.0) - im)) return tmp
function code(re, im) t_0 = Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) tmp = 0.0 if (im <= 4.3) tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) + Float64(1.0 + t_0))); elseif (im <= 6.5e+99) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(t_0 + 2.0) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))); tmp = 0.0; if (im <= 4.3) tmp = (0.5 * cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + t_0)); elseif (im <= 6.5e+99) tmp = 0.5 + (0.5 * exp(im)); else tmp = 0.5 * (cos(re) * ((t_0 + 2.0) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 4.3], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(t$95$0 + 2.0), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;im \leq 4.3:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(\left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right) + \left(1 + t\_0\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(t\_0 + 2\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 4.29999999999999982Initial program 100.0%
Taylor expanded in im around 0 87.4%
Taylor expanded in im around 0 63.5%
*-commutative63.5%
Simplified63.5%
if 4.29999999999999982 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 77.8%
distribute-lft-in77.8%
metadata-eval77.8%
Simplified77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.2%
*-commutative0.1%
Simplified96.2%
Taylor expanded in re around inf 96.2%
Final simplification70.4%
(FPCore (re im)
:precision binary64
(if (<= im 3.1)
(*
(* 0.5 (cos re))
(+
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))
(+ 1.0 (* im (+ 1.0 (* 0.5 im))))))
(if (<= im 6.5e+99)
(+ 0.5 (* 0.5 (exp im)))
(*
0.5
(*
(cos re)
(-
(+ (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))) 2.0)
im))))))
double code(double re, double im) {
double tmp;
if (im <= 3.1) {
tmp = (0.5 * cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = 0.5 * (cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 3.1d0) then
tmp = (0.5d0 * cos(re)) * ((1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))) + (1.0d0 + (im * (1.0d0 + (0.5d0 * im)))))
else if (im <= 6.5d+99) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = 0.5d0 * (cos(re) * (((im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))) + 2.0d0) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.1) {
tmp = (0.5 * Math.cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = 0.5 * (Math.cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.1: tmp = (0.5 * math.cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im))))) elif im <= 6.5e+99: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = 0.5 * (math.cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.1) tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))))); elseif (im <= 6.5e+99) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) + 2.0) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.1) tmp = (0.5 * cos(re)) * ((1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))) + (1.0 + (im * (1.0 + (0.5 * im))))); elseif (im <= 6.5e+99) tmp = 0.5 + (0.5 * exp(im)); else tmp = 0.5 * (cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.1], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.1:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(\left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right) + \left(1 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right) + 2\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 3.10000000000000009Initial program 100.0%
Taylor expanded in im around 0 87.4%
Taylor expanded in im around 0 87.4%
if 3.10000000000000009 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 77.8%
distribute-lft-in77.8%
metadata-eval77.8%
Simplified77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.2%
*-commutative0.1%
Simplified96.2%
Taylor expanded in re around inf 96.2%
Final simplification88.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666)))))))
(if (<= im 4.2)
(* (* 0.5 (cos re)) (+ (- 1.0 im) (+ 1.0 t_0)))
(if (<= im 6.5e+99)
(+ 0.5 (* 0.5 (exp im)))
(* 0.5 (* (cos re) (- (+ t_0 2.0) im)))))))
double code(double re, double im) {
double t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double tmp;
if (im <= 4.2) {
tmp = (0.5 * cos(re)) * ((1.0 - im) + (1.0 + t_0));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = 0.5 * (cos(re) * ((t_0 + 2.0) - im));
}
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 = im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))
if (im <= 4.2d0) then
tmp = (0.5d0 * cos(re)) * ((1.0d0 - im) + (1.0d0 + t_0))
else if (im <= 6.5d+99) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = 0.5d0 * (cos(re) * ((t_0 + 2.0d0) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))));
double tmp;
if (im <= 4.2) {
tmp = (0.5 * Math.cos(re)) * ((1.0 - im) + (1.0 + t_0));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = 0.5 * (Math.cos(re) * ((t_0 + 2.0) - im));
}
return tmp;
}
def code(re, im): t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))) tmp = 0 if im <= 4.2: tmp = (0.5 * math.cos(re)) * ((1.0 - im) + (1.0 + t_0)) elif im <= 6.5e+99: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = 0.5 * (math.cos(re) * ((t_0 + 2.0) - im)) return tmp
function code(re, im) t_0 = Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) tmp = 0.0 if (im <= 4.2) tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(1.0 - im) + Float64(1.0 + t_0))); elseif (im <= 6.5e+99) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(t_0 + 2.0) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))); tmp = 0.0; if (im <= 4.2) tmp = (0.5 * cos(re)) * ((1.0 - im) + (1.0 + t_0)); elseif (im <= 6.5e+99) tmp = 0.5 + (0.5 * exp(im)); else tmp = 0.5 * (cos(re) * ((t_0 + 2.0) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 4.2], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - im), $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(t$95$0 + 2.0), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;im \leq 4.2:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(\left(1 - im\right) + \left(1 + t\_0\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(t\_0 + 2\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 4.20000000000000018Initial program 100.0%
Taylor expanded in im around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in im around 0 63.2%
*-commutative63.5%
Simplified63.2%
if 4.20000000000000018 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 77.8%
distribute-lft-in77.8%
metadata-eval77.8%
Simplified77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.2%
*-commutative0.1%
Simplified96.2%
Taylor expanded in re around inf 96.2%
Final simplification70.2%
(FPCore (re im)
:precision binary64
(if (<= im 2.7)
(* (* 0.5 (cos re)) (+ (- 1.0 im) (+ 1.0 (* im (+ 1.0 (* 0.5 im))))))
(if (<= im 6.5e+99)
(+ 0.5 (* 0.5 (exp im)))
(*
0.5
(*
(cos re)
(-
(+ (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))) 2.0)
im))))))
double code(double re, double im) {
double tmp;
if (im <= 2.7) {
tmp = (0.5 * cos(re)) * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = 0.5 * (cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.7d0) then
tmp = (0.5d0 * cos(re)) * ((1.0d0 - im) + (1.0d0 + (im * (1.0d0 + (0.5d0 * im)))))
else if (im <= 6.5d+99) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = 0.5d0 * (cos(re) * (((im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))) + 2.0d0) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.7) {
tmp = (0.5 * Math.cos(re)) * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = 0.5 * (Math.cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.7: tmp = (0.5 * math.cos(re)) * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im))))) elif im <= 6.5e+99: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = 0.5 * (math.cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.7) tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(1.0 - im) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))))); elseif (im <= 6.5e+99) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) + 2.0) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.7) tmp = (0.5 * cos(re)) * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im))))); elseif (im <= 6.5e+99) tmp = 0.5 + (0.5 * exp(im)); else tmp = 0.5 * (cos(re) * (((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.7], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - im), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.7:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(\left(1 - im\right) + \left(1 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right) + 2\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 2.7000000000000002Initial program 100.0%
Taylor expanded in im around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in im around 0 79.9%
if 2.7000000000000002 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 77.8%
distribute-lft-in77.8%
metadata-eval77.8%
Simplified77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 96.2%
*-commutative0.1%
Simplified96.2%
Taylor expanded in re around inf 96.2%
Final simplification82.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (cos re))))
(if (<= im 2.2)
(* t_0 (+ (- 1.0 im) (+ 1.0 (* im (+ 1.0 (* 0.5 im))))))
(if (<= im 6.5e+99)
(+ 0.5 (* 0.5 (exp im)))
(*
t_0
(+ (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))) 2.0))))))
double code(double re, double im) {
double t_0 = 0.5 * cos(re);
double tmp;
if (im <= 2.2) {
tmp = t_0 * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = t_0 * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.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 = 0.5d0 * cos(re)
if (im <= 2.2d0) then
tmp = t_0 * ((1.0d0 - im) + (1.0d0 + (im * (1.0d0 + (0.5d0 * im)))))
else if (im <= 6.5d+99) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = t_0 * ((im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))) + 2.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.cos(re);
double tmp;
if (im <= 2.2) {
tmp = t_0 * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im)))));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = t_0 * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.cos(re) tmp = 0 if im <= 2.2: tmp = t_0 * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im))))) elif im <= 6.5e+99: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = t_0 * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) return tmp
function code(re, im) t_0 = Float64(0.5 * cos(re)) tmp = 0.0 if (im <= 2.2) tmp = Float64(t_0 * Float64(Float64(1.0 - im) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))))); elseif (im <= 6.5e+99) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(t_0 * Float64(Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) + 2.0)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * cos(re); tmp = 0.0; if (im <= 2.2) tmp = t_0 * ((1.0 - im) + (1.0 + (im * (1.0 + (0.5 * im))))); elseif (im <= 6.5e+99) tmp = 0.5 + (0.5 * exp(im)); else tmp = t_0 * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2.2], N[(t$95$0 * N[(N[(1.0 - im), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \cos re\\
\mathbf{if}\;im \leq 2.2:\\
\;\;\;\;t\_0 \cdot \left(\left(1 - im\right) + \left(1 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right) + 2\right)\\
\end{array}
\end{array}
if im < 2.2000000000000002Initial program 100.0%
Taylor expanded in im around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in im around 0 79.9%
if 2.2000000000000002 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 77.8%
distribute-lft-in77.8%
metadata-eval77.8%
Simplified77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around 0 96.2%
*-commutative96.2%
Simplified96.2%
Final simplification82.7%
(FPCore (re im)
:precision binary64
(if (<= im 1.85)
(* 0.5 (* (cos re) (- (+ 2.0 (* im (+ 1.0 (* 0.5 im)))) im)))
(if (<= im 6.5e+99)
(+ 0.5 (* 0.5 (exp im)))
(*
(* 0.5 (cos re))
(+ (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))) 2.0)))))
double code(double re, double im) {
double tmp;
if (im <= 1.85) {
tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = (0.5 * cos(re)) * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.85d0) then
tmp = 0.5d0 * (cos(re) * ((2.0d0 + (im * (1.0d0 + (0.5d0 * im)))) - im))
else if (im <= 6.5d+99) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = (0.5d0 * cos(re)) * ((im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0))))) + 2.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.85) {
tmp = 0.5 * (Math.cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im));
} else if (im <= 6.5e+99) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = (0.5 * Math.cos(re)) * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.85: tmp = 0.5 * (math.cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im)) elif im <= 6.5e+99: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = (0.5 * math.cos(re)) * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.85) tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))) - im))); elseif (im <= 6.5e+99) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666))))) + 2.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.85) tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im)); elseif (im <= 6.5e+99) tmp = 0.5 + (0.5 * exp(im)); else tmp = (0.5 * cos(re)) * ((im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))) + 2.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.85], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(2.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.5e+99], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.85:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(2 + im \cdot \left(1 + 0.5 \cdot im\right)\right) - im\right)\right)\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+99}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right) + 2\right)\\
\end{array}
\end{array}
if im < 1.8500000000000001Initial program 100.0%
Taylor expanded in im around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in im around 0 79.9%
Taylor expanded in re around inf 79.9%
if 1.8500000000000001 < im < 6.5000000000000004e99Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 77.8%
distribute-lft-in77.8%
metadata-eval77.8%
Simplified77.8%
if 6.5000000000000004e99 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around 0 96.2%
*-commutative96.2%
Simplified96.2%
Final simplification82.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 2.0 (* im (+ 1.0 (* 0.5 im))))))
(if (<= im 2.9)
(* 0.5 (* (cos re) (- t_0 im)))
(if (<= im 9.2e+153) (+ 0.5 (* 0.5 (exp im))) (* (* 0.5 (cos re)) t_0)))))
double code(double re, double im) {
double t_0 = 2.0 + (im * (1.0 + (0.5 * im)));
double tmp;
if (im <= 2.9) {
tmp = 0.5 * (cos(re) * (t_0 - im));
} else if (im <= 9.2e+153) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = (0.5 * cos(re)) * 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 = 2.0d0 + (im * (1.0d0 + (0.5d0 * im)))
if (im <= 2.9d0) then
tmp = 0.5d0 * (cos(re) * (t_0 - im))
else if (im <= 9.2d+153) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = (0.5d0 * cos(re)) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 2.0 + (im * (1.0 + (0.5 * im)));
double tmp;
if (im <= 2.9) {
tmp = 0.5 * (Math.cos(re) * (t_0 - im));
} else if (im <= 9.2e+153) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = (0.5 * Math.cos(re)) * t_0;
}
return tmp;
}
def code(re, im): t_0 = 2.0 + (im * (1.0 + (0.5 * im))) tmp = 0 if im <= 2.9: tmp = 0.5 * (math.cos(re) * (t_0 - im)) elif im <= 9.2e+153: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = (0.5 * math.cos(re)) * t_0 return tmp
function code(re, im) t_0 = Float64(2.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))) tmp = 0.0 if (im <= 2.9) tmp = Float64(0.5 * Float64(cos(re) * Float64(t_0 - im))); elseif (im <= 9.2e+153) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(Float64(0.5 * cos(re)) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 2.0 + (im * (1.0 + (0.5 * im))); tmp = 0.0; if (im <= 2.9) tmp = 0.5 * (cos(re) * (t_0 - im)); elseif (im <= 9.2e+153) tmp = 0.5 + (0.5 * exp(im)); else tmp = (0.5 * cos(re)) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2.9], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(t$95$0 - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2e+153], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + im \cdot \left(1 + 0.5 \cdot im\right)\\
\mathbf{if}\;im \leq 2.9:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(t\_0 - im\right)\right)\\
\mathbf{elif}\;im \leq 9.2 \cdot 10^{+153}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t\_0\\
\end{array}
\end{array}
if im < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in im around 0 79.9%
Taylor expanded in re around inf 79.9%
if 2.89999999999999991 < im < 9.2000000000000005e153Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 75.0%
distribute-lft-in75.0%
metadata-eval75.0%
Simplified75.0%
if 9.2000000000000005e153 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around 0 100.0%
(FPCore (re im)
:precision binary64
(if (<= im 2.0)
(cos re)
(if (<= im 9.2e+153)
(+ 0.5 (* 0.5 (exp im)))
(* (* 0.5 (cos re)) (+ 2.0 (* im (+ 1.0 (* 0.5 im))))))))
double code(double re, double im) {
double tmp;
if (im <= 2.0) {
tmp = cos(re);
} else if (im <= 9.2e+153) {
tmp = 0.5 + (0.5 * exp(im));
} else {
tmp = (0.5 * cos(re)) * (2.0 + (im * (1.0 + (0.5 * im))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.0d0) then
tmp = cos(re)
else if (im <= 9.2d+153) then
tmp = 0.5d0 + (0.5d0 * exp(im))
else
tmp = (0.5d0 * cos(re)) * (2.0d0 + (im * (1.0d0 + (0.5d0 * im))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.0) {
tmp = Math.cos(re);
} else if (im <= 9.2e+153) {
tmp = 0.5 + (0.5 * Math.exp(im));
} else {
tmp = (0.5 * Math.cos(re)) * (2.0 + (im * (1.0 + (0.5 * im))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.0: tmp = math.cos(re) elif im <= 9.2e+153: tmp = 0.5 + (0.5 * math.exp(im)) else: tmp = (0.5 * math.cos(re)) * (2.0 + (im * (1.0 + (0.5 * im)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.0) tmp = cos(re); elseif (im <= 9.2e+153) tmp = Float64(0.5 + Float64(0.5 * exp(im))); else tmp = Float64(Float64(0.5 * cos(re)) * Float64(2.0 + Float64(im * Float64(1.0 + Float64(0.5 * im))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.0) tmp = cos(re); elseif (im <= 9.2e+153) tmp = 0.5 + (0.5 * exp(im)); else tmp = (0.5 * cos(re)) * (2.0 + (im * (1.0 + (0.5 * im)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.0], N[Cos[re], $MachinePrecision], If[LessEqual[im, 9.2e+153], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 9.2 \cdot 10^{+153}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot \left(1 + 0.5 \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 2Initial program 100.0%
Taylor expanded in im around 0 64.3%
if 2 < im < 9.2000000000000005e153Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 75.0%
distribute-lft-in75.0%
metadata-eval75.0%
Simplified75.0%
if 9.2000000000000005e153 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around 0 100.0%
(FPCore (re im) :precision binary64 (if (<= im 2.65) (cos re) (+ 0.5 (* 0.5 (exp im)))))
double code(double re, double im) {
double tmp;
if (im <= 2.65) {
tmp = cos(re);
} else {
tmp = 0.5 + (0.5 * exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.65d0) then
tmp = cos(re)
else
tmp = 0.5d0 + (0.5d0 * exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.65) {
tmp = Math.cos(re);
} else {
tmp = 0.5 + (0.5 * Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.65: tmp = math.cos(re) else: tmp = 0.5 + (0.5 * math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.65) tmp = cos(re); else tmp = Float64(0.5 + Float64(0.5 * exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.65) tmp = cos(re); else tmp = 0.5 + (0.5 * exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.65], N[Cos[re], $MachinePrecision], N[(0.5 + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.65:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{im}\\
\end{array}
\end{array}
if im < 2.64999999999999991Initial program 100.0%
Taylor expanded in im around 0 64.3%
if 2.64999999999999991 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 70.3%
distribute-lft-in70.3%
metadata-eval70.3%
Simplified70.3%
(FPCore (re im)
:precision binary64
(if (<= im 26000.0)
(cos re)
(if (<= im 5e+102)
(- 2.0 (* re re))
(+ 1.0 (* im (+ 0.5 (* im (+ 0.25 (* im 0.08333333333333333)))))))))
double code(double re, double im) {
double tmp;
if (im <= 26000.0) {
tmp = cos(re);
} else if (im <= 5e+102) {
tmp = 2.0 - (re * re);
} else {
tmp = 1.0 + (im * (0.5 + (im * (0.25 + (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 (im <= 26000.0d0) then
tmp = cos(re)
else if (im <= 5d+102) then
tmp = 2.0d0 - (re * re)
else
tmp = 1.0d0 + (im * (0.5d0 + (im * (0.25d0 + (im * 0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 26000.0) {
tmp = Math.cos(re);
} else if (im <= 5e+102) {
tmp = 2.0 - (re * re);
} else {
tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 26000.0: tmp = math.cos(re) elif im <= 5e+102: tmp = 2.0 - (re * re) else: tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))) return tmp
function code(re, im) tmp = 0.0 if (im <= 26000.0) tmp = cos(re); elseif (im <= 5e+102) tmp = Float64(2.0 - Float64(re * re)); else tmp = Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * Float64(0.25 + Float64(im * 0.08333333333333333)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 26000.0) tmp = cos(re); elseif (im <= 5e+102) tmp = 2.0 - (re * re); else tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 26000.0], N[Cos[re], $MachinePrecision], If[LessEqual[im, 5e+102], N[(2.0 - N[(re * re), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(im * N[(0.5 + N[(im * N[(0.25 + N[(im * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 26000:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+102}:\\
\;\;\;\;2 - re \cdot re\\
\mathbf{else}:\\
\;\;\;\;1 + im \cdot \left(0.5 + im \cdot \left(0.25 + im \cdot 0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if im < 26000Initial program 100.0%
Taylor expanded in im around 0 64.0%
if 26000 < im < 5e102Initial program 100.0%
Applied egg-rr3.1%
count-23.1%
Simplified3.1%
Taylor expanded in re around 0 17.9%
mul-1-neg17.9%
unsub-neg17.9%
Simplified17.9%
unpow217.9%
Applied egg-rr17.9%
if 5e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in re around 0 70.5%
distribute-lft-in70.5%
metadata-eval70.5%
Simplified70.5%
Taylor expanded in im around 0 70.5%
*-commutative70.5%
Simplified70.5%
(FPCore (re im) :precision binary64 (if (<= re 1.08e+195) (+ 1.0 (* im (+ 0.5 (* im (+ 0.25 (* im 0.08333333333333333)))))) (- 2.0 (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 1.08e+195) {
tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
} else {
tmp = 2.0 - (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.08d+195) then
tmp = 1.0d0 + (im * (0.5d0 + (im * (0.25d0 + (im * 0.08333333333333333d0)))))
else
tmp = 2.0d0 - (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.08e+195) {
tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
} else {
tmp = 2.0 - (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.08e+195: tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))) else: tmp = 2.0 - (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.08e+195) tmp = Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * Float64(0.25 + Float64(im * 0.08333333333333333)))))); else tmp = Float64(2.0 - Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.08e+195) tmp = 1.0 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))); else tmp = 2.0 - (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.08e+195], N[(1.0 + N[(im * N[(0.5 + N[(im * N[(0.25 + N[(im * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.08 \cdot 10^{+195}:\\
\;\;\;\;1 + im \cdot \left(0.5 + im \cdot \left(0.25 + im \cdot 0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 - re \cdot re\\
\end{array}
\end{array}
if re < 1.0800000000000001e195Initial program 100.0%
Taylor expanded in im around 0 74.3%
neg-mul-174.3%
unsub-neg74.3%
Simplified74.3%
Taylor expanded in im around 0 73.4%
Taylor expanded in re around 0 45.3%
distribute-lft-in45.3%
metadata-eval45.3%
Simplified45.3%
Taylor expanded in im around 0 44.3%
*-commutative44.3%
Simplified44.3%
if 1.0800000000000001e195 < re Initial program 100.0%
Applied egg-rr10.5%
count-210.5%
Simplified10.5%
Taylor expanded in re around 0 30.3%
mul-1-neg30.3%
unsub-neg30.3%
Simplified30.3%
unpow230.3%
Applied egg-rr30.3%
(FPCore (re im) :precision binary64 (if (<= re 1.08e+195) (* 0.5 (- (+ 2.0 (* im (+ 1.0 (* 0.5 im)))) im)) (- 2.0 (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 1.08e+195) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im);
} else {
tmp = 2.0 - (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.08d+195) then
tmp = 0.5d0 * ((2.0d0 + (im * (1.0d0 + (0.5d0 * im)))) - im)
else
tmp = 2.0d0 - (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.08e+195) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im);
} else {
tmp = 2.0 - (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.08e+195: tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im) else: tmp = 2.0 - (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.08e+195) tmp = Float64(0.5 * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))) - im)); else tmp = Float64(2.0 - Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.08e+195) tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im); else tmp = 2.0 - (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.08e+195], N[(0.5 * N[(N[(2.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(2.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.08 \cdot 10^{+195}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + im \cdot \left(1 + 0.5 \cdot im\right)\right) - im\right)\\
\mathbf{else}:\\
\;\;\;\;2 - re \cdot re\\
\end{array}
\end{array}
if re < 1.0800000000000001e195Initial program 100.0%
Taylor expanded in im around 0 74.3%
neg-mul-174.3%
unsub-neg74.3%
Simplified74.3%
Taylor expanded in im around 0 74.3%
Taylor expanded in re around 0 46.3%
if 1.0800000000000001e195 < re Initial program 100.0%
Applied egg-rr10.5%
count-210.5%
Simplified10.5%
Taylor expanded in re around 0 30.3%
mul-1-neg30.3%
unsub-neg30.3%
Simplified30.3%
unpow230.3%
Applied egg-rr30.3%
(FPCore (re im) :precision binary64 (if (<= re 1.08e+195) (+ 1.0 (* im (+ 0.5 (* im 0.25)))) (- 2.0 (* re re))))
double code(double re, double im) {
double tmp;
if (re <= 1.08e+195) {
tmp = 1.0 + (im * (0.5 + (im * 0.25)));
} else {
tmp = 2.0 - (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.08d+195) then
tmp = 1.0d0 + (im * (0.5d0 + (im * 0.25d0)))
else
tmp = 2.0d0 - (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.08e+195) {
tmp = 1.0 + (im * (0.5 + (im * 0.25)));
} else {
tmp = 2.0 - (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.08e+195: tmp = 1.0 + (im * (0.5 + (im * 0.25))) else: tmp = 2.0 - (re * re) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.08e+195) tmp = Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.25)))); else tmp = Float64(2.0 - Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.08e+195) tmp = 1.0 + (im * (0.5 + (im * 0.25))); else tmp = 2.0 - (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.08e+195], N[(1.0 + N[(im * N[(0.5 + N[(im * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.08 \cdot 10^{+195}:\\
\;\;\;\;1 + im \cdot \left(0.5 + im \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;2 - re \cdot re\\
\end{array}
\end{array}
if re < 1.0800000000000001e195Initial program 100.0%
Taylor expanded in im around 0 74.3%
neg-mul-174.3%
unsub-neg74.3%
Simplified74.3%
Taylor expanded in im around 0 73.4%
Taylor expanded in re around 0 45.3%
distribute-lft-in45.3%
metadata-eval45.3%
Simplified45.3%
Taylor expanded in im around 0 46.1%
*-commutative46.1%
Simplified46.1%
if 1.0800000000000001e195 < re Initial program 100.0%
Applied egg-rr10.5%
count-210.5%
Simplified10.5%
Taylor expanded in re around 0 30.3%
mul-1-neg30.3%
unsub-neg30.3%
Simplified30.3%
unpow230.3%
Applied egg-rr30.3%
(FPCore (re im) :precision binary64 (if (<= im 26000.0) 1.0 (- 2.0 (* re re))))
double code(double re, double im) {
double tmp;
if (im <= 26000.0) {
tmp = 1.0;
} else {
tmp = 2.0 - (re * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 26000.0d0) then
tmp = 1.0d0
else
tmp = 2.0d0 - (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 26000.0) {
tmp = 1.0;
} else {
tmp = 2.0 - (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 26000.0: tmp = 1.0 else: tmp = 2.0 - (re * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 26000.0) tmp = 1.0; else tmp = Float64(2.0 - Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 26000.0) tmp = 1.0; else tmp = 2.0 - (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 26000.0], 1.0, N[(2.0 - N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 26000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;2 - re \cdot re\\
\end{array}
\end{array}
if im < 26000Initial program 100.0%
Taylor expanded in im around 0 65.3%
neg-mul-165.3%
unsub-neg65.3%
Simplified65.3%
Taylor expanded in im around 0 64.1%
Taylor expanded in re around 0 34.9%
distribute-lft-in34.9%
metadata-eval34.9%
Simplified34.9%
Taylor expanded in im around 0 34.6%
if 26000 < im Initial program 100.0%
Applied egg-rr3.1%
count-23.1%
Simplified3.1%
Taylor expanded in re around 0 15.2%
mul-1-neg15.2%
unsub-neg15.2%
Simplified15.2%
unpow215.2%
Applied egg-rr15.2%
(FPCore (re im) :precision binary64 (+ 1.0 (* 0.5 im)))
double code(double re, double im) {
return 1.0 + (0.5 * im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + (0.5d0 * im)
end function
public static double code(double re, double im) {
return 1.0 + (0.5 * im);
}
def code(re, im): return 1.0 + (0.5 * im)
function code(re, im) return Float64(1.0 + Float64(0.5 * im)) end
function tmp = code(re, im) tmp = 1.0 + (0.5 * im); end
code[re_, im_] := N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot im
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 73.8%
neg-mul-173.8%
unsub-neg73.8%
Simplified73.8%
Taylor expanded in im around 0 72.9%
Taylor expanded in re around 0 43.5%
distribute-lft-in43.5%
metadata-eval43.5%
Simplified43.5%
Taylor expanded in im around 0 26.7%
+-commutative26.7%
*-commutative26.7%
Simplified26.7%
Final simplification26.7%
(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 73.8%
neg-mul-173.8%
unsub-neg73.8%
Simplified73.8%
Taylor expanded in im around 0 72.9%
Taylor expanded in re around 0 43.5%
distribute-lft-in43.5%
metadata-eval43.5%
Simplified43.5%
Taylor expanded in im around 0 26.6%
(FPCore (re im) :precision binary64 0.75)
double code(double re, double im) {
return 0.75;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.75d0
end function
public static double code(double re, double im) {
return 0.75;
}
def code(re, im): return 0.75
function code(re, im) return 0.75 end
function tmp = code(re, im) tmp = 0.75; end
code[re_, im_] := 0.75
\begin{array}{l}
\\
0.75
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 62.1%
Applied egg-rr8.8%
metadata-eval8.8%
Applied egg-rr8.8%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 100.0%
Applied egg-rr2.3%
pow-base-12.3%
metadata-eval2.3%
Simplified2.3%
herbie shell --seed 2024113
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))