
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (or (<= (sin re) -0.01) (not (<= (sin re) 5e-16)))
(*
(* 0.5 (sin re))
(+ (+ 2.0 (* im im)) (* (pow im 4.0) 0.08333333333333333)))
(* 0.5 (+ (/ re (exp im)) (* re (exp im))))))
double code(double re, double im) {
double tmp;
if ((sin(re) <= -0.01) || !(sin(re) <= 5e-16)) {
tmp = (0.5 * sin(re)) * ((2.0 + (im * im)) + (pow(im, 4.0) * 0.08333333333333333));
} else {
tmp = 0.5 * ((re / exp(im)) + (re * exp(im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((sin(re) <= (-0.01d0)) .or. (.not. (sin(re) <= 5d-16))) then
tmp = (0.5d0 * sin(re)) * ((2.0d0 + (im * im)) + ((im ** 4.0d0) * 0.08333333333333333d0))
else
tmp = 0.5d0 * ((re / exp(im)) + (re * exp(im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.sin(re) <= -0.01) || !(Math.sin(re) <= 5e-16)) {
tmp = (0.5 * Math.sin(re)) * ((2.0 + (im * im)) + (Math.pow(im, 4.0) * 0.08333333333333333));
} else {
tmp = 0.5 * ((re / Math.exp(im)) + (re * Math.exp(im)));
}
return tmp;
}
def code(re, im): tmp = 0 if (math.sin(re) <= -0.01) or not (math.sin(re) <= 5e-16): tmp = (0.5 * math.sin(re)) * ((2.0 + (im * im)) + (math.pow(im, 4.0) * 0.08333333333333333)) else: tmp = 0.5 * ((re / math.exp(im)) + (re * math.exp(im))) return tmp
function code(re, im) tmp = 0.0 if ((sin(re) <= -0.01) || !(sin(re) <= 5e-16)) tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(2.0 + Float64(im * im)) + Float64((im ^ 4.0) * 0.08333333333333333))); else tmp = Float64(0.5 * Float64(Float64(re / exp(im)) + Float64(re * exp(im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((sin(re) <= -0.01) || ~((sin(re) <= 5e-16))) tmp = (0.5 * sin(re)) * ((2.0 + (im * im)) + ((im ^ 4.0) * 0.08333333333333333)); else tmp = 0.5 * ((re / exp(im)) + (re * exp(im))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[N[Sin[re], $MachinePrecision], -0.01], N[Not[LessEqual[N[Sin[re], $MachinePrecision], 5e-16]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(re / N[Exp[im], $MachinePrecision]), $MachinePrecision] + N[(re * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.01 \lor \neg \left(\sin re \leq 5 \cdot 10^{-16}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\frac{re}{e^{im}} + re \cdot e^{im}\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0100000000000000002 or 5.0000000000000004e-16 < (sin.f64 re) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 91.1%
associate-+r+91.1%
unpow291.1%
Simplified91.1%
if -0.0100000000000000002 < (sin.f64 re) < 5.0000000000000004e-16Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
distribute-rgt-in100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification95.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))))
(if (<= im -9e+96)
(* (pow im 4.0) (* (sin re) 0.041666666666666664))
(if (<= im -31000000.0)
(* (+ (exp (- im)) (exp im)) (* 0.5 re))
(if (<= im 370.0)
(* t_0 (+ (+ 2.0 (* im im)) (* (pow im 4.0) 0.08333333333333333)))
(log1p (expm1 (* im (* t_0 im)))))))))
double code(double re, double im) {
double t_0 = 0.5 * sin(re);
double tmp;
if (im <= -9e+96) {
tmp = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
} else if (im <= -31000000.0) {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
} else if (im <= 370.0) {
tmp = t_0 * ((2.0 + (im * im)) + (pow(im, 4.0) * 0.08333333333333333));
} else {
tmp = log1p(expm1((im * (t_0 * im))));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = 0.5 * Math.sin(re);
double tmp;
if (im <= -9e+96) {
tmp = Math.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
} else if (im <= -31000000.0) {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
} else if (im <= 370.0) {
tmp = t_0 * ((2.0 + (im * im)) + (Math.pow(im, 4.0) * 0.08333333333333333));
} else {
tmp = Math.log1p(Math.expm1((im * (t_0 * im))));
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.sin(re) tmp = 0 if im <= -9e+96: tmp = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664) elif im <= -31000000.0: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) elif im <= 370.0: tmp = t_0 * ((2.0 + (im * im)) + (math.pow(im, 4.0) * 0.08333333333333333)) else: tmp = math.log1p(math.expm1((im * (t_0 * im)))) return tmp
function code(re, im) t_0 = Float64(0.5 * sin(re)) tmp = 0.0 if (im <= -9e+96) tmp = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664)); elseif (im <= -31000000.0) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); elseif (im <= 370.0) tmp = Float64(t_0 * Float64(Float64(2.0 + Float64(im * im)) + Float64((im ^ 4.0) * 0.08333333333333333))); else tmp = log1p(expm1(Float64(im * Float64(t_0 * im)))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -9e+96], N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -31000000.0], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 370.0], N[(t$95$0 * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(im * N[(t$95$0 * im), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
\mathbf{if}\;im \leq -9 \cdot 10^{+96}:\\
\;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;im \leq 370:\\
\;\;\;\;t_0 \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(t_0 \cdot im\right)\right)\right)\\
\end{array}
\end{array}
if im < -8.99999999999999914e96Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -8.99999999999999914e96 < im < -3.1e7Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -3.1e7 < im < 370Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.6%
associate-+r+97.6%
unpow297.6%
Simplified97.6%
if 370 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 58.3%
unpow258.3%
Simplified58.3%
Taylor expanded in im around inf 58.3%
associate-*r*58.3%
*-commutative58.3%
unpow258.3%
Simplified58.3%
log1p-expm1-u94.9%
associate-*l*94.9%
Applied egg-rr94.9%
Final simplification97.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (+ (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* (pow im 4.0) (* (sin re) 0.041666666666666664))))
(if (<= im -9e+96)
t_1
(if (<= im -31000000.0)
t_0
(if (<= im 6.2)
(* (* 0.5 (sin re)) (+ 2.0 (* im im)))
(if (<= im 1.15e+77) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) + exp(im)) * (0.5 * re);
double t_1 = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
double tmp;
if (im <= -9e+96) {
tmp = t_1;
} else if (im <= -31000000.0) {
tmp = t_0;
} else if (im <= 6.2) {
tmp = (0.5 * sin(re)) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (exp(-im) + exp(im)) * (0.5d0 * re)
t_1 = (im ** 4.0d0) * (sin(re) * 0.041666666666666664d0)
if (im <= (-9d+96)) then
tmp = t_1
else if (im <= (-31000000.0d0)) then
tmp = t_0
else if (im <= 6.2d0) then
tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
else if (im <= 1.15d+77) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
double t_1 = Math.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
double tmp;
if (im <= -9e+96) {
tmp = t_1;
} else if (im <= -31000000.0) {
tmp = t_0;
} else if (im <= 6.2) {
tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) + math.exp(im)) * (0.5 * re) t_1 = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664) tmp = 0 if im <= -9e+96: tmp = t_1 elif im <= -31000000.0: tmp = t_0 elif im <= 6.2: tmp = (0.5 * math.sin(re)) * (2.0 + (im * im)) elif im <= 1.15e+77: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)) t_1 = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664)) tmp = 0.0 if (im <= -9e+96) tmp = t_1; elseif (im <= -31000000.0) tmp = t_0; elseif (im <= 6.2) tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.15e+77) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) + exp(im)) * (0.5 * re); t_1 = (im ^ 4.0) * (sin(re) * 0.041666666666666664); tmp = 0.0; if (im <= -9e+96) tmp = t_1; elseif (im <= -31000000.0) tmp = t_0; elseif (im <= 6.2) tmp = (0.5 * sin(re)) * (2.0 + (im * im)); elseif (im <= 1.15e+77) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -9e+96], t$95$1, If[LessEqual[im, -31000000.0], t$95$0, If[LessEqual[im, 6.2], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+77], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := {im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\
\mathbf{if}\;im \leq -9 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 6.2:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -8.99999999999999914e96 or 1.14999999999999997e77 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -8.99999999999999914e96 < im < -3.1e7 or 6.20000000000000018 < im < 1.14999999999999997e77Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 87.5%
associate-*r*87.5%
*-commutative87.5%
Simplified87.5%
if -3.1e7 < im < 6.20000000000000018Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.1%
unpow297.1%
Simplified97.1%
Final simplification97.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 4.0) (* (sin re) 0.041666666666666664))))
(if (<= im -3.7)
t_0
(if (<= im 2.1e+21)
(* (* 0.5 (sin re)) (+ 2.0 (* im im)))
(if (<= im 1.15e+77) (* 0.5 (fma (exp im) re (* re re))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
double tmp;
if (im <= -3.7) {
tmp = t_0;
} else if (im <= 2.1e+21) {
tmp = (0.5 * sin(re)) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = 0.5 * fma(exp(im), re, (re * re));
} else {
tmp = t_0;
}
return tmp;
}
function code(re, im) t_0 = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664)) tmp = 0.0 if (im <= -3.7) tmp = t_0; elseif (im <= 2.1e+21) tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.15e+77) tmp = Float64(0.5 * fma(exp(im), re, Float64(re * re))); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.7], t$95$0, If[LessEqual[im, 2.1e+21], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(0.5 * N[(N[Exp[im], $MachinePrecision] * re + N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\
\mathbf{if}\;im \leq -3.7:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+21}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \mathsf{fma}\left(e^{im}, re, re \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.7000000000000002 or 1.14999999999999997e77 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 89.4%
associate-+r+89.4%
unpow289.4%
Simplified89.4%
Taylor expanded in im around inf 89.4%
*-commutative89.4%
*-commutative89.4%
associate-*l*89.4%
Simplified89.4%
if -3.7000000000000002 < im < 2.1e21Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.0%
unpow297.0%
Simplified97.0%
if 2.1e21 < im < 1.14999999999999997e77Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 71.4%
distribute-rgt-in71.4%
fma-def71.4%
exp-neg71.4%
associate-*l/71.4%
*-lft-identity71.4%
Simplified71.4%
Applied egg-rr71.4%
Final simplification93.1%
(FPCore (re im) :precision binary64 (if (or (<= im -3.7) (not (<= im 3.7))) (* (pow im 4.0) (* (sin re) 0.041666666666666664)) (* (* 0.5 (sin re)) (+ 2.0 (* im im)))))
double code(double re, double im) {
double tmp;
if ((im <= -3.7) || !(im <= 3.7)) {
tmp = pow(im, 4.0) * (sin(re) * 0.041666666666666664);
} else {
tmp = (0.5 * sin(re)) * (2.0 + (im * 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.7d0)) .or. (.not. (im <= 3.7d0))) then
tmp = (im ** 4.0d0) * (sin(re) * 0.041666666666666664d0)
else
tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.7) || !(im <= 3.7)) {
tmp = Math.pow(im, 4.0) * (Math.sin(re) * 0.041666666666666664);
} else {
tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.7) or not (im <= 3.7): tmp = math.pow(im, 4.0) * (math.sin(re) * 0.041666666666666664) else: tmp = (0.5 * math.sin(re)) * (2.0 + (im * im)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.7) || !(im <= 3.7)) tmp = Float64((im ^ 4.0) * Float64(sin(re) * 0.041666666666666664)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.7) || ~((im <= 3.7))) tmp = (im ^ 4.0) * (sin(re) * 0.041666666666666664); else tmp = (0.5 * sin(re)) * (2.0 + (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.7], N[Not[LessEqual[im, 3.7]], $MachinePrecision]], N[(N[Power[im, 4.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.7 \lor \neg \left(im \leq 3.7\right):\\
\;\;\;\;{im}^{4} \cdot \left(\sin re \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if im < -3.7000000000000002 or 3.7000000000000002 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 82.2%
associate-+r+82.2%
unpow282.2%
Simplified82.2%
Taylor expanded in im around inf 82.2%
*-commutative82.2%
*-commutative82.2%
associate-*l*82.2%
Simplified82.2%
if -3.7000000000000002 < im < 3.7000000000000002Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.9%
unpow298.9%
Simplified98.9%
Final simplification91.3%
(FPCore (re im)
:precision binary64
(if (<= im -3.3e+14)
(* (* 0.5 re) (* im im))
(if (<= im 16500000000000.0)
(sin re)
(if (<= im 2.9e+151)
(+ re (* (pow re 3.0) -0.16666666666666666))
(* (* 0.5 (sin re)) (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= -3.3e+14) {
tmp = (0.5 * re) * (im * im);
} else if (im <= 16500000000000.0) {
tmp = sin(re);
} else if (im <= 2.9e+151) {
tmp = re + (pow(re, 3.0) * -0.16666666666666666);
} else {
tmp = (0.5 * sin(re)) * (im * 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.3d+14)) then
tmp = (0.5d0 * re) * (im * im)
else if (im <= 16500000000000.0d0) then
tmp = sin(re)
else if (im <= 2.9d+151) then
tmp = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
else
tmp = (0.5d0 * sin(re)) * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.3e+14) {
tmp = (0.5 * re) * (im * im);
} else if (im <= 16500000000000.0) {
tmp = Math.sin(re);
} else if (im <= 2.9e+151) {
tmp = re + (Math.pow(re, 3.0) * -0.16666666666666666);
} else {
tmp = (0.5 * Math.sin(re)) * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.3e+14: tmp = (0.5 * re) * (im * im) elif im <= 16500000000000.0: tmp = math.sin(re) elif im <= 2.9e+151: tmp = re + (math.pow(re, 3.0) * -0.16666666666666666) else: tmp = (0.5 * math.sin(re)) * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= -3.3e+14) tmp = Float64(Float64(0.5 * re) * Float64(im * im)); elseif (im <= 16500000000000.0) tmp = sin(re); elseif (im <= 2.9e+151) tmp = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.3e+14) tmp = (0.5 * re) * (im * im); elseif (im <= 16500000000000.0) tmp = sin(re); elseif (im <= 2.9e+151) tmp = re + ((re ^ 3.0) * -0.16666666666666666); else tmp = (0.5 * sin(re)) * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.3e+14], N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 16500000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.9e+151], N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.3 \cdot 10^{+14}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 16500000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 2.9 \cdot 10^{+151}:\\
\;\;\;\;re + {re}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < -3.3e14Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 49.8%
unpow249.8%
Simplified49.8%
Taylor expanded in im around inf 49.8%
associate-*r*49.8%
*-commutative49.8%
unpow249.8%
Simplified49.8%
Taylor expanded in re around 0 52.4%
associate-*r*52.4%
unpow252.4%
Simplified52.4%
if -3.3e14 < im < 1.65e13Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 95.5%
if 1.65e13 < im < 2.90000000000000018e151Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in re around 0 7.3%
*-commutative7.3%
associate-*l*7.3%
metadata-eval7.3%
associate-*l*7.3%
metadata-eval7.3%
distribute-rgt-out7.3%
*-commutative7.3%
*-commutative7.3%
associate-*l*7.3%
distribute-lft-out29.0%
+-commutative29.0%
unpow229.0%
fma-def29.0%
distribute-rgt-out29.0%
metadata-eval29.0%
*-commutative29.0%
associate-*r*29.0%
metadata-eval29.0%
Simplified29.0%
Taylor expanded in im around 0 23.8%
distribute-lft-in23.8%
associate-*r*23.8%
metadata-eval23.8%
*-lft-identity23.8%
*-commutative23.8%
*-commutative23.8%
associate-*l*23.8%
metadata-eval23.8%
Simplified23.8%
if 2.90000000000000018e151 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.2%
unpow297.2%
Simplified97.2%
Taylor expanded in im around inf 97.2%
associate-*r*97.2%
*-commutative97.2%
unpow297.2%
Simplified97.2%
Final simplification79.7%
(FPCore (re im)
:precision binary64
(if (<= im -3200000000.0)
(* (* 0.5 re) (* im im))
(if (<= im 16500000000000.0)
(sin re)
(if (<= im 6.3e+150)
(+ re (* (pow re 3.0) -0.16666666666666666))
(* 0.5 (* re (+ 2.0 (* im im))))))))
double code(double re, double im) {
double tmp;
if (im <= -3200000000.0) {
tmp = (0.5 * re) * (im * im);
} else if (im <= 16500000000000.0) {
tmp = sin(re);
} else if (im <= 6.3e+150) {
tmp = re + (pow(re, 3.0) * -0.16666666666666666);
} else {
tmp = 0.5 * (re * (2.0 + (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-3200000000.0d0)) then
tmp = (0.5d0 * re) * (im * im)
else if (im <= 16500000000000.0d0) then
tmp = sin(re)
else if (im <= 6.3d+150) then
tmp = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
else
tmp = 0.5d0 * (re * (2.0d0 + (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3200000000.0) {
tmp = (0.5 * re) * (im * im);
} else if (im <= 16500000000000.0) {
tmp = Math.sin(re);
} else if (im <= 6.3e+150) {
tmp = re + (Math.pow(re, 3.0) * -0.16666666666666666);
} else {
tmp = 0.5 * (re * (2.0 + (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3200000000.0: tmp = (0.5 * re) * (im * im) elif im <= 16500000000000.0: tmp = math.sin(re) elif im <= 6.3e+150: tmp = re + (math.pow(re, 3.0) * -0.16666666666666666) else: tmp = 0.5 * (re * (2.0 + (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= -3200000000.0) tmp = Float64(Float64(0.5 * re) * Float64(im * im)); elseif (im <= 16500000000000.0) tmp = sin(re); elseif (im <= 6.3e+150) tmp = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)); else tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3200000000.0) tmp = (0.5 * re) * (im * im); elseif (im <= 16500000000000.0) tmp = sin(re); elseif (im <= 6.3e+150) tmp = re + ((re ^ 3.0) * -0.16666666666666666); else tmp = 0.5 * (re * (2.0 + (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3200000000.0], N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 16500000000000.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 6.3e+150], N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(re * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3200000000:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 16500000000000:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 6.3 \cdot 10^{+150}:\\
\;\;\;\;re + {re}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < -3.2e9Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 49.8%
unpow249.8%
Simplified49.8%
Taylor expanded in im around inf 49.8%
associate-*r*49.8%
*-commutative49.8%
unpow249.8%
Simplified49.8%
Taylor expanded in re around 0 52.4%
associate-*r*52.4%
unpow252.4%
Simplified52.4%
if -3.2e9 < im < 1.65e13Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 95.5%
if 1.65e13 < im < 6.3000000000000003e150Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in re around 0 7.3%
*-commutative7.3%
associate-*l*7.3%
metadata-eval7.3%
associate-*l*7.3%
metadata-eval7.3%
distribute-rgt-out7.3%
*-commutative7.3%
*-commutative7.3%
associate-*l*7.3%
distribute-lft-out29.0%
+-commutative29.0%
unpow229.0%
fma-def29.0%
distribute-rgt-out29.0%
metadata-eval29.0%
*-commutative29.0%
associate-*r*29.0%
metadata-eval29.0%
Simplified29.0%
Taylor expanded in im around 0 23.8%
distribute-lft-in23.8%
associate-*r*23.8%
metadata-eval23.8%
*-lft-identity23.8%
*-commutative23.8%
*-commutative23.8%
associate-*l*23.8%
metadata-eval23.8%
Simplified23.8%
if 6.3000000000000003e150 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.2%
unpow297.2%
Simplified97.2%
Taylor expanded in re around 0 73.0%
*-commutative73.0%
unpow273.0%
Simplified73.0%
Final simplification76.6%
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ 2.0 (* im im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (2.0 + (im * im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (2.0 + (im * im));
}
def code(re, im): return (0.5 * math.sin(re)) * (2.0 + (im * im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (2.0 + (im * im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 77.9%
unpow277.9%
Simplified77.9%
Final simplification77.9%
(FPCore (re im) :precision binary64 (if (<= im -2050000000000.0) (* (* 0.5 re) (* im im)) (if (<= im 1.02e+88) (sin re) (* 0.5 (* re (+ 2.0 (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= -2050000000000.0) {
tmp = (0.5 * re) * (im * im);
} else if (im <= 1.02e+88) {
tmp = sin(re);
} else {
tmp = 0.5 * (re * (2.0 + (im * im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-2050000000000.0d0)) then
tmp = (0.5d0 * re) * (im * im)
else if (im <= 1.02d+88) then
tmp = sin(re)
else
tmp = 0.5d0 * (re * (2.0d0 + (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -2050000000000.0) {
tmp = (0.5 * re) * (im * im);
} else if (im <= 1.02e+88) {
tmp = Math.sin(re);
} else {
tmp = 0.5 * (re * (2.0 + (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2050000000000.0: tmp = (0.5 * re) * (im * im) elif im <= 1.02e+88: tmp = math.sin(re) else: tmp = 0.5 * (re * (2.0 + (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= -2050000000000.0) tmp = Float64(Float64(0.5 * re) * Float64(im * im)); elseif (im <= 1.02e+88) tmp = sin(re); else tmp = Float64(0.5 * Float64(re * Float64(2.0 + Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2050000000000.0) tmp = (0.5 * re) * (im * im); elseif (im <= 1.02e+88) tmp = sin(re); else tmp = 0.5 * (re * (2.0 + (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2050000000000.0], N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.02e+88], N[Sin[re], $MachinePrecision], N[(0.5 * N[(re * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2050000000000:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.02 \cdot 10^{+88}:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < -2.05e12Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 49.8%
unpow249.8%
Simplified49.8%
Taylor expanded in im around inf 49.8%
associate-*r*49.8%
*-commutative49.8%
unpow249.8%
Simplified49.8%
Taylor expanded in re around 0 52.4%
associate-*r*52.4%
unpow252.4%
Simplified52.4%
if -2.05e12 < im < 1.01999999999999998e88Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 89.5%
if 1.01999999999999998e88 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 71.4%
unpow271.4%
Simplified71.4%
Taylor expanded in re around 0 53.8%
*-commutative53.8%
unpow253.8%
Simplified53.8%
Final simplification74.8%
(FPCore (re im) :precision binary64 (if (or (<= im -31000000.0) (not (<= im 6.2))) (* 0.5 (* im (* re im))) re))
double code(double re, double im) {
double tmp;
if ((im <= -31000000.0) || !(im <= 6.2)) {
tmp = 0.5 * (im * (re * im));
} else {
tmp = re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-31000000.0d0)) .or. (.not. (im <= 6.2d0))) then
tmp = 0.5d0 * (im * (re * im))
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -31000000.0) || !(im <= 6.2)) {
tmp = 0.5 * (im * (re * im));
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -31000000.0) or not (im <= 6.2): tmp = 0.5 * (im * (re * im)) else: tmp = re return tmp
function code(re, im) tmp = 0.0 if ((im <= -31000000.0) || !(im <= 6.2)) tmp = Float64(0.5 * Float64(im * Float64(re * im))); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -31000000.0) || ~((im <= 6.2))) tmp = 0.5 * (im * (re * im)); else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -31000000.0], N[Not[LessEqual[im, 6.2]], $MachinePrecision]], N[(0.5 * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -31000000 \lor \neg \left(im \leq 6.2\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -3.1e7 or 6.20000000000000018 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 54.0%
unpow254.0%
Simplified54.0%
Taylor expanded in im around inf 54.0%
associate-*r*54.0%
*-commutative54.0%
unpow254.0%
Simplified54.0%
Taylor expanded in re around 0 48.1%
*-commutative48.1%
unpow248.1%
associate-*l*30.1%
Simplified30.1%
if -3.1e7 < im < 6.20000000000000018Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 52.5%
associate-*r*52.5%
*-commutative52.5%
Simplified52.5%
Taylor expanded in im around 0 51.6%
Final simplification42.0%
(FPCore (re im) :precision binary64 (if (or (<= im -31000000.0) (not (<= im 6.2))) (* (* 0.5 re) (* im im)) re))
double code(double re, double im) {
double tmp;
if ((im <= -31000000.0) || !(im <= 6.2)) {
tmp = (0.5 * re) * (im * im);
} else {
tmp = re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-31000000.0d0)) .or. (.not. (im <= 6.2d0))) then
tmp = (0.5d0 * re) * (im * im)
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -31000000.0) || !(im <= 6.2)) {
tmp = (0.5 * re) * (im * im);
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -31000000.0) or not (im <= 6.2): tmp = (0.5 * re) * (im * im) else: tmp = re return tmp
function code(re, im) tmp = 0.0 if ((im <= -31000000.0) || !(im <= 6.2)) tmp = Float64(Float64(0.5 * re) * Float64(im * im)); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -31000000.0) || ~((im <= 6.2))) tmp = (0.5 * re) * (im * im); else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -31000000.0], N[Not[LessEqual[im, 6.2]], $MachinePrecision]], N[(N[(0.5 * re), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -31000000 \lor \neg \left(im \leq 6.2\right):\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -3.1e7 or 6.20000000000000018 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 54.0%
unpow254.0%
Simplified54.0%
Taylor expanded in im around inf 54.0%
associate-*r*54.0%
*-commutative54.0%
unpow254.0%
Simplified54.0%
Taylor expanded in re around 0 48.1%
associate-*r*48.1%
unpow248.1%
Simplified48.1%
if -3.1e7 < im < 6.20000000000000018Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 52.5%
associate-*r*52.5%
*-commutative52.5%
Simplified52.5%
Taylor expanded in im around 0 51.6%
Final simplification50.0%
(FPCore (re im) :precision binary64 (* 0.5 (* re (+ 2.0 (* im im)))))
double code(double re, double im) {
return 0.5 * (re * (2.0 + (im * im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (re * (2.0d0 + (im * im)))
end function
public static double code(double re, double im) {
return 0.5 * (re * (2.0 + (im * im)));
}
def code(re, im): return 0.5 * (re * (2.0 + (im * im)))
function code(re, im) return Float64(0.5 * Float64(re * Float64(2.0 + Float64(im * im)))) end
function tmp = code(re, im) tmp = 0.5 * (re * (2.0 + (im * im))); end
code[re_, im_] := N[(0.5 * N[(re * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(re \cdot \left(2 + im \cdot im\right)\right)
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 77.9%
unpow277.9%
Simplified77.9%
Taylor expanded in re around 0 50.3%
*-commutative50.3%
unpow250.3%
Simplified50.3%
Final simplification50.3%
(FPCore (re im) :precision binary64 1.9380669946781485e-10)
double code(double re, double im) {
return 1.9380669946781485e-10;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.9380669946781485d-10
end function
public static double code(double re, double im) {
return 1.9380669946781485e-10;
}
def code(re, im): return 1.9380669946781485e-10
function code(re, im) return 1.9380669946781485e-10 end
function tmp = code(re, im) tmp = 1.9380669946781485e-10; end
code[re_, im_] := 1.9380669946781485e-10
\begin{array}{l}
\\
1.9380669946781485 \cdot 10^{-10}
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 91.5%
associate-+r+91.5%
unpow291.5%
Simplified91.5%
Applied egg-rr3.7%
*-commutative3.7%
+-inverses3.7%
+-rgt-identity3.7%
associate-/l*3.7%
*-inverses3.7%
metadata-eval3.7%
Simplified3.7%
Final simplification3.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%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr5.0%
+-inverses5.0%
+-rgt-identity5.0%
*-inverses5.0%
Simplified5.0%
Final simplification5.0%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 64.7%
associate-*r*64.7%
*-commutative64.7%
Simplified64.7%
Taylor expanded in im around 0 29.8%
Final simplification29.8%
herbie shell --seed 2023182
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))