
(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 12 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
(let* ((t_0 (* (+ (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (+ re (* (* 0.5 (sin re)) (* im im)))))
(if (<= im -1.32e+154)
t_1
(if (<= im -108000.0)
t_0
(if (<= im 1.6e-5) (sin re) (if (<= im 3.15e+153) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) + exp(im)) * (0.5 * re);
double t_1 = re + ((0.5 * sin(re)) * (im * im));
double tmp;
if (im <= -1.32e+154) {
tmp = t_1;
} else if (im <= -108000.0) {
tmp = t_0;
} else if (im <= 1.6e-5) {
tmp = sin(re);
} else if (im <= 3.15e+153) {
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 = re + ((0.5d0 * sin(re)) * (im * im))
if (im <= (-1.32d+154)) then
tmp = t_1
else if (im <= (-108000.0d0)) then
tmp = t_0
else if (im <= 1.6d-5) then
tmp = sin(re)
else if (im <= 3.15d+153) 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 = re + ((0.5 * Math.sin(re)) * (im * im));
double tmp;
if (im <= -1.32e+154) {
tmp = t_1;
} else if (im <= -108000.0) {
tmp = t_0;
} else if (im <= 1.6e-5) {
tmp = Math.sin(re);
} else if (im <= 3.15e+153) {
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 = re + ((0.5 * math.sin(re)) * (im * im)) tmp = 0 if im <= -1.32e+154: tmp = t_1 elif im <= -108000.0: tmp = t_0 elif im <= 1.6e-5: tmp = math.sin(re) elif im <= 3.15e+153: 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(re + Float64(Float64(0.5 * sin(re)) * Float64(im * im))) tmp = 0.0 if (im <= -1.32e+154) tmp = t_1; elseif (im <= -108000.0) tmp = t_0; elseif (im <= 1.6e-5) tmp = sin(re); elseif (im <= 3.15e+153) 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 = re + ((0.5 * sin(re)) * (im * im)); tmp = 0.0; if (im <= -1.32e+154) tmp = t_1; elseif (im <= -108000.0) tmp = t_0; elseif (im <= 1.6e-5) tmp = sin(re); elseif (im <= 3.15e+153) 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[(re + N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.32e+154], t$95$1, If[LessEqual[im, -108000.0], t$95$0, If[LessEqual[im, 1.6e-5], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3.15e+153], 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 := re + \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -108000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3.15 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.31999999999999998e154 or 3.1500000000000001e153 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.5%
Simplified98.5%
Taylor expanded in re around 0 98.5%
if -1.31999999999999998e154 < im < -108000 or 1.59999999999999993e-5 < im < 3.1500000000000001e153Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 79.3%
if -108000 < im < 1.59999999999999993e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.2%
Final simplification93.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (+ (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (+ re (* (* 0.5 (sin re)) (* im im)))))
(if (<= im -1.32e+154)
t_1
(if (<= im -108000.0)
t_0
(if (<= im 0.0305)
(+ (sin re) (* 0.5 (* im (* (sin re) im))))
(if (<= im 3.15e+153) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) + exp(im)) * (0.5 * re);
double t_1 = re + ((0.5 * sin(re)) * (im * im));
double tmp;
if (im <= -1.32e+154) {
tmp = t_1;
} else if (im <= -108000.0) {
tmp = t_0;
} else if (im <= 0.0305) {
tmp = sin(re) + (0.5 * (im * (sin(re) * im)));
} else if (im <= 3.15e+153) {
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 = re + ((0.5d0 * sin(re)) * (im * im))
if (im <= (-1.32d+154)) then
tmp = t_1
else if (im <= (-108000.0d0)) then
tmp = t_0
else if (im <= 0.0305d0) then
tmp = sin(re) + (0.5d0 * (im * (sin(re) * im)))
else if (im <= 3.15d+153) 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 = re + ((0.5 * Math.sin(re)) * (im * im));
double tmp;
if (im <= -1.32e+154) {
tmp = t_1;
} else if (im <= -108000.0) {
tmp = t_0;
} else if (im <= 0.0305) {
tmp = Math.sin(re) + (0.5 * (im * (Math.sin(re) * im)));
} else if (im <= 3.15e+153) {
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 = re + ((0.5 * math.sin(re)) * (im * im)) tmp = 0 if im <= -1.32e+154: tmp = t_1 elif im <= -108000.0: tmp = t_0 elif im <= 0.0305: tmp = math.sin(re) + (0.5 * (im * (math.sin(re) * im))) elif im <= 3.15e+153: 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(re + Float64(Float64(0.5 * sin(re)) * Float64(im * im))) tmp = 0.0 if (im <= -1.32e+154) tmp = t_1; elseif (im <= -108000.0) tmp = t_0; elseif (im <= 0.0305) tmp = Float64(sin(re) + Float64(0.5 * Float64(im * Float64(sin(re) * im)))); elseif (im <= 3.15e+153) 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 = re + ((0.5 * sin(re)) * (im * im)); tmp = 0.0; if (im <= -1.32e+154) tmp = t_1; elseif (im <= -108000.0) tmp = t_0; elseif (im <= 0.0305) tmp = sin(re) + (0.5 * (im * (sin(re) * im))); elseif (im <= 3.15e+153) 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[(re + N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.32e+154], t$95$1, If[LessEqual[im, -108000.0], t$95$0, If[LessEqual[im, 0.0305], N[(N[Sin[re], $MachinePrecision] + N[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.15e+153], 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 := re + \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -108000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0305:\\
\;\;\;\;\sin re + 0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 3.15 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.31999999999999998e154 or 3.1500000000000001e153 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.5%
Simplified98.5%
Taylor expanded in re around 0 98.5%
if -1.31999999999999998e154 < im < -108000 or 0.030499999999999999 < im < 3.1500000000000001e153Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 79.3%
if -108000 < im < 0.030499999999999999Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.3%
Simplified97.3%
Taylor expanded in re around inf 97.3%
Simplified97.3%
Final simplification93.1%
(FPCore (re im)
:precision binary64
(if (<= im -4.7e+85)
(+ re (* (* 0.5 (sin re)) (* im im)))
(if (<= im -1.6e+33)
(pow re -512.0)
(if (or (<= im -480.0) (not (<= im 4e-5)))
(+
(sin re)
(* (* im im) (* re (+ 0.5 (* -0.08333333333333333 (* re re))))))
(sin re)))))
double code(double re, double im) {
double tmp;
if (im <= -4.7e+85) {
tmp = re + ((0.5 * sin(re)) * (im * im));
} else if (im <= -1.6e+33) {
tmp = pow(re, -512.0);
} else if ((im <= -480.0) || !(im <= 4e-5)) {
tmp = sin(re) + ((im * im) * (re * (0.5 + (-0.08333333333333333 * (re * re)))));
} else {
tmp = sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-4.7d+85)) then
tmp = re + ((0.5d0 * sin(re)) * (im * im))
else if (im <= (-1.6d+33)) then
tmp = re ** (-512.0d0)
else if ((im <= (-480.0d0)) .or. (.not. (im <= 4d-5))) then
tmp = sin(re) + ((im * im) * (re * (0.5d0 + ((-0.08333333333333333d0) * (re * re)))))
else
tmp = sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -4.7e+85) {
tmp = re + ((0.5 * Math.sin(re)) * (im * im));
} else if (im <= -1.6e+33) {
tmp = Math.pow(re, -512.0);
} else if ((im <= -480.0) || !(im <= 4e-5)) {
tmp = Math.sin(re) + ((im * im) * (re * (0.5 + (-0.08333333333333333 * (re * re)))));
} else {
tmp = Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -4.7e+85: tmp = re + ((0.5 * math.sin(re)) * (im * im)) elif im <= -1.6e+33: tmp = math.pow(re, -512.0) elif (im <= -480.0) or not (im <= 4e-5): tmp = math.sin(re) + ((im * im) * (re * (0.5 + (-0.08333333333333333 * (re * re))))) else: tmp = math.sin(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -4.7e+85) tmp = Float64(re + Float64(Float64(0.5 * sin(re)) * Float64(im * im))); elseif (im <= -1.6e+33) tmp = re ^ -512.0; elseif ((im <= -480.0) || !(im <= 4e-5)) tmp = Float64(sin(re) + Float64(Float64(im * im) * Float64(re * Float64(0.5 + Float64(-0.08333333333333333 * Float64(re * re)))))); else tmp = sin(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -4.7e+85) tmp = re + ((0.5 * sin(re)) * (im * im)); elseif (im <= -1.6e+33) tmp = re ^ -512.0; elseif ((im <= -480.0) || ~((im <= 4e-5))) tmp = sin(re) + ((im * im) * (re * (0.5 + (-0.08333333333333333 * (re * re))))); else tmp = sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -4.7e+85], N[(re + N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -1.6e+33], N[Power[re, -512.0], $MachinePrecision], If[Or[LessEqual[im, -480.0], N[Not[LessEqual[im, 4e-5]], $MachinePrecision]], N[(N[Sin[re], $MachinePrecision] + N[(N[(im * im), $MachinePrecision] * N[(re * N[(0.5 + N[(-0.08333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[re], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.7 \cdot 10^{+85}:\\
\;\;\;\;re + \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq -1.6 \cdot 10^{+33}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq -480 \lor \neg \left(im \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;\sin re + \left(im \cdot im\right) \cdot \left(re \cdot \left(0.5 + -0.08333333333333333 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re\\
\end{array}
\end{array}
if im < -4.7000000000000002e85Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.9%
Simplified69.9%
Taylor expanded in re around 0 69.8%
if -4.7000000000000002e85 < im < -1.60000000000000009e33Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 95.0%
Applied egg-rr50.4%
if -1.60000000000000009e33 < im < -480 or 4.00000000000000033e-5 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 46.2%
Simplified46.2%
Taylor expanded in re around inf 46.2%
Simplified34.6%
Taylor expanded in re around 0 12.5%
associate-*r*12.5%
associate-*r*12.5%
distribute-rgt-out62.5%
unpow262.5%
unpow362.5%
associate-*r*62.5%
distribute-rgt-out62.5%
Simplified62.5%
if -480 < im < 4.00000000000000033e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.6%
Final simplification82.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ re (* (* im im) (* 0.5 re))))
(t_1 (+ re (* (pow re 3.0) -0.16666666666666666))))
(if (<= im -2.65e+213)
t_0
(if (<= im -2.6e+182)
t_1
(if (<= im -3.7e+85)
t_0
(if (<= im -4.9e+33)
(pow re -512.0)
(if (<= im -500.0)
t_1
(if (<= im 0.225) (sin re) (if (<= im 3e+217) t_1 t_0)))))))))
double code(double re, double im) {
double t_0 = re + ((im * im) * (0.5 * re));
double t_1 = re + (pow(re, 3.0) * -0.16666666666666666);
double tmp;
if (im <= -2.65e+213) {
tmp = t_0;
} else if (im <= -2.6e+182) {
tmp = t_1;
} else if (im <= -3.7e+85) {
tmp = t_0;
} else if (im <= -4.9e+33) {
tmp = pow(re, -512.0);
} else if (im <= -500.0) {
tmp = t_1;
} else if (im <= 0.225) {
tmp = sin(re);
} else if (im <= 3e+217) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = re + ((im * im) * (0.5d0 * re))
t_1 = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
if (im <= (-2.65d+213)) then
tmp = t_0
else if (im <= (-2.6d+182)) then
tmp = t_1
else if (im <= (-3.7d+85)) then
tmp = t_0
else if (im <= (-4.9d+33)) then
tmp = re ** (-512.0d0)
else if (im <= (-500.0d0)) then
tmp = t_1
else if (im <= 0.225d0) then
tmp = sin(re)
else if (im <= 3d+217) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re + ((im * im) * (0.5 * re));
double t_1 = re + (Math.pow(re, 3.0) * -0.16666666666666666);
double tmp;
if (im <= -2.65e+213) {
tmp = t_0;
} else if (im <= -2.6e+182) {
tmp = t_1;
} else if (im <= -3.7e+85) {
tmp = t_0;
} else if (im <= -4.9e+33) {
tmp = Math.pow(re, -512.0);
} else if (im <= -500.0) {
tmp = t_1;
} else if (im <= 0.225) {
tmp = Math.sin(re);
} else if (im <= 3e+217) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re + ((im * im) * (0.5 * re)) t_1 = re + (math.pow(re, 3.0) * -0.16666666666666666) tmp = 0 if im <= -2.65e+213: tmp = t_0 elif im <= -2.6e+182: tmp = t_1 elif im <= -3.7e+85: tmp = t_0 elif im <= -4.9e+33: tmp = math.pow(re, -512.0) elif im <= -500.0: tmp = t_1 elif im <= 0.225: tmp = math.sin(re) elif im <= 3e+217: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re))) t_1 = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)) tmp = 0.0 if (im <= -2.65e+213) tmp = t_0; elseif (im <= -2.6e+182) tmp = t_1; elseif (im <= -3.7e+85) tmp = t_0; elseif (im <= -4.9e+33) tmp = re ^ -512.0; elseif (im <= -500.0) tmp = t_1; elseif (im <= 0.225) tmp = sin(re); elseif (im <= 3e+217) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re + ((im * im) * (0.5 * re)); t_1 = re + ((re ^ 3.0) * -0.16666666666666666); tmp = 0.0; if (im <= -2.65e+213) tmp = t_0; elseif (im <= -2.6e+182) tmp = t_1; elseif (im <= -3.7e+85) tmp = t_0; elseif (im <= -4.9e+33) tmp = re ^ -512.0; elseif (im <= -500.0) tmp = t_1; elseif (im <= 0.225) tmp = sin(re); elseif (im <= 3e+217) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.65e+213], t$95$0, If[LessEqual[im, -2.6e+182], t$95$1, If[LessEqual[im, -3.7e+85], t$95$0, If[LessEqual[im, -4.9e+33], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, -500.0], t$95$1, If[LessEqual[im, 0.225], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3e+217], t$95$1, t$95$0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := re + {re}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -2.65 \cdot 10^{+213}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -2.6 \cdot 10^{+182}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -3.7 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -4.9 \cdot 10^{+33}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq -500:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 0.225:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3 \cdot 10^{+217}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.6499999999999999e213 or -2.6e182 < im < -3.7000000000000002e85 or 2.99999999999999976e217 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 75.0%
Simplified75.0%
Taylor expanded in re around 0 75.0%
Taylor expanded in re around 0 61.1%
if -2.6499999999999999e213 < im < -2.6e182 or -4.90000000000000014e33 < im < -500 or 0.225000000000000006 < im < 2.99999999999999976e217Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.5%
Taylor expanded in re around 0 48.7%
Simplified48.7%
if -3.7000000000000002e85 < im < -4.90000000000000014e33Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 95.0%
Applied egg-rr50.4%
if -500 < im < 0.225000000000000006Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.6%
Final simplification77.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ re (* (pow re 3.0) -0.16666666666666666)))
(t_1 (+ re (* (* 0.5 (sin re)) (* im im)))))
(if (<= im -4.7e+85)
t_1
(if (<= im -1.48e+32)
(pow re -512.0)
(if (<= im -540.0)
t_0
(if (<= im 0.225) (sin re) (if (<= im 7.2e+153) t_0 t_1)))))))
double code(double re, double im) {
double t_0 = re + (pow(re, 3.0) * -0.16666666666666666);
double t_1 = re + ((0.5 * sin(re)) * (im * im));
double tmp;
if (im <= -4.7e+85) {
tmp = t_1;
} else if (im <= -1.48e+32) {
tmp = pow(re, -512.0);
} else if (im <= -540.0) {
tmp = t_0;
} else if (im <= 0.225) {
tmp = sin(re);
} else if (im <= 7.2e+153) {
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 = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
t_1 = re + ((0.5d0 * sin(re)) * (im * im))
if (im <= (-4.7d+85)) then
tmp = t_1
else if (im <= (-1.48d+32)) then
tmp = re ** (-512.0d0)
else if (im <= (-540.0d0)) then
tmp = t_0
else if (im <= 0.225d0) then
tmp = sin(re)
else if (im <= 7.2d+153) 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 = re + (Math.pow(re, 3.0) * -0.16666666666666666);
double t_1 = re + ((0.5 * Math.sin(re)) * (im * im));
double tmp;
if (im <= -4.7e+85) {
tmp = t_1;
} else if (im <= -1.48e+32) {
tmp = Math.pow(re, -512.0);
} else if (im <= -540.0) {
tmp = t_0;
} else if (im <= 0.225) {
tmp = Math.sin(re);
} else if (im <= 7.2e+153) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = re + (math.pow(re, 3.0) * -0.16666666666666666) t_1 = re + ((0.5 * math.sin(re)) * (im * im)) tmp = 0 if im <= -4.7e+85: tmp = t_1 elif im <= -1.48e+32: tmp = math.pow(re, -512.0) elif im <= -540.0: tmp = t_0 elif im <= 0.225: tmp = math.sin(re) elif im <= 7.2e+153: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)) t_1 = Float64(re + Float64(Float64(0.5 * sin(re)) * Float64(im * im))) tmp = 0.0 if (im <= -4.7e+85) tmp = t_1; elseif (im <= -1.48e+32) tmp = re ^ -512.0; elseif (im <= -540.0) tmp = t_0; elseif (im <= 0.225) tmp = sin(re); elseif (im <= 7.2e+153) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = re + ((re ^ 3.0) * -0.16666666666666666); t_1 = re + ((0.5 * sin(re)) * (im * im)); tmp = 0.0; if (im <= -4.7e+85) tmp = t_1; elseif (im <= -1.48e+32) tmp = re ^ -512.0; elseif (im <= -540.0) tmp = t_0; elseif (im <= 0.225) tmp = sin(re); elseif (im <= 7.2e+153) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re + N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.7e+85], t$95$1, If[LessEqual[im, -1.48e+32], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, -540.0], t$95$0, If[LessEqual[im, 0.225], N[Sin[re], $MachinePrecision], If[LessEqual[im, 7.2e+153], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re + {re}^{3} \cdot -0.16666666666666666\\
t_1 := re + \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq -4.7 \cdot 10^{+85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.48 \cdot 10^{+32}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq -540:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.225:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 7.2 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.7000000000000002e85 or 7.2000000000000001e153 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 80.6%
Simplified80.6%
Taylor expanded in re around 0 80.5%
if -4.7000000000000002e85 < im < -1.4799999999999999e32Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 95.0%
Applied egg-rr50.4%
if -1.4799999999999999e32 < im < -540 or 0.225000000000000006 < im < 7.2000000000000001e153Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.8%
Taylor expanded in re around 0 39.8%
Simplified39.8%
if -540 < im < 0.225000000000000006Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.6%
Final simplification82.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ re (* (pow re 3.0) -0.16666666666666666))))
(if (<= im -6e+181)
(* im (* (sin re) (* 0.5 im)))
(if (<= im -5.6e+32)
(pow re -512.0)
(if (<= im -405.0)
t_0
(if (<= im 0.225)
(sin re)
(if (<= im 3e+217) t_0 (+ re (* (* im im) (* 0.5 re))))))))))
double code(double re, double im) {
double t_0 = re + (pow(re, 3.0) * -0.16666666666666666);
double tmp;
if (im <= -6e+181) {
tmp = im * (sin(re) * (0.5 * im));
} else if (im <= -5.6e+32) {
tmp = pow(re, -512.0);
} else if (im <= -405.0) {
tmp = t_0;
} else if (im <= 0.225) {
tmp = sin(re);
} else if (im <= 3e+217) {
tmp = t_0;
} else {
tmp = re + ((im * im) * (0.5 * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re + ((re ** 3.0d0) * (-0.16666666666666666d0))
if (im <= (-6d+181)) then
tmp = im * (sin(re) * (0.5d0 * im))
else if (im <= (-5.6d+32)) then
tmp = re ** (-512.0d0)
else if (im <= (-405.0d0)) then
tmp = t_0
else if (im <= 0.225d0) then
tmp = sin(re)
else if (im <= 3d+217) then
tmp = t_0
else
tmp = re + ((im * im) * (0.5d0 * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re + (Math.pow(re, 3.0) * -0.16666666666666666);
double tmp;
if (im <= -6e+181) {
tmp = im * (Math.sin(re) * (0.5 * im));
} else if (im <= -5.6e+32) {
tmp = Math.pow(re, -512.0);
} else if (im <= -405.0) {
tmp = t_0;
} else if (im <= 0.225) {
tmp = Math.sin(re);
} else if (im <= 3e+217) {
tmp = t_0;
} else {
tmp = re + ((im * im) * (0.5 * re));
}
return tmp;
}
def code(re, im): t_0 = re + (math.pow(re, 3.0) * -0.16666666666666666) tmp = 0 if im <= -6e+181: tmp = im * (math.sin(re) * (0.5 * im)) elif im <= -5.6e+32: tmp = math.pow(re, -512.0) elif im <= -405.0: tmp = t_0 elif im <= 0.225: tmp = math.sin(re) elif im <= 3e+217: tmp = t_0 else: tmp = re + ((im * im) * (0.5 * re)) return tmp
function code(re, im) t_0 = Float64(re + Float64((re ^ 3.0) * -0.16666666666666666)) tmp = 0.0 if (im <= -6e+181) tmp = Float64(im * Float64(sin(re) * Float64(0.5 * im))); elseif (im <= -5.6e+32) tmp = re ^ -512.0; elseif (im <= -405.0) tmp = t_0; elseif (im <= 0.225) tmp = sin(re); elseif (im <= 3e+217) tmp = t_0; else tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re))); end return tmp end
function tmp_2 = code(re, im) t_0 = re + ((re ^ 3.0) * -0.16666666666666666); tmp = 0.0; if (im <= -6e+181) tmp = im * (sin(re) * (0.5 * im)); elseif (im <= -5.6e+32) tmp = re ^ -512.0; elseif (im <= -405.0) tmp = t_0; elseif (im <= 0.225) tmp = sin(re); elseif (im <= 3e+217) tmp = t_0; else tmp = re + ((im * im) * (0.5 * re)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(N[Power[re, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6e+181], N[(im * N[(N[Sin[re], $MachinePrecision] * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -5.6e+32], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, -405.0], t$95$0, If[LessEqual[im, 0.225], N[Sin[re], $MachinePrecision], If[LessEqual[im, 3e+217], t$95$0, N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re + {re}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -6 \cdot 10^{+181}:\\
\;\;\;\;im \cdot \left(\sin re \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{elif}\;im \leq -5.6 \cdot 10^{+32}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq -405:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.225:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 3 \cdot 10^{+217}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < -6.00000000000000024e181Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*92.8%
*-commutative92.8%
associate-*r*92.8%
associate-*l*92.8%
Simplified92.8%
if -6.00000000000000024e181 < im < -5.6e32Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 86.8%
Applied egg-rr34.7%
if -5.6e32 < im < -405 or 0.225000000000000006 < im < 2.99999999999999976e217Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.6%
Taylor expanded in re around 0 44.8%
Simplified44.8%
if -405 < im < 0.225000000000000006Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.6%
if 2.99999999999999976e217 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Taylor expanded in re around 0 85.7%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ re (* (* im im) (* 0.5 re)))))
(if (<= im -4.5e+85)
t_0
(if (<= im -1.7e+31) (pow re -512.0) (if (<= im 0.0152) (sin re) t_0)))))
double code(double re, double im) {
double t_0 = re + ((im * im) * (0.5 * re));
double tmp;
if (im <= -4.5e+85) {
tmp = t_0;
} else if (im <= -1.7e+31) {
tmp = pow(re, -512.0);
} else if (im <= 0.0152) {
tmp = sin(re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = re + ((im * im) * (0.5d0 * re))
if (im <= (-4.5d+85)) then
tmp = t_0
else if (im <= (-1.7d+31)) then
tmp = re ** (-512.0d0)
else if (im <= 0.0152d0) then
tmp = sin(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re + ((im * im) * (0.5 * re));
double tmp;
if (im <= -4.5e+85) {
tmp = t_0;
} else if (im <= -1.7e+31) {
tmp = Math.pow(re, -512.0);
} else if (im <= 0.0152) {
tmp = Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re + ((im * im) * (0.5 * re)) tmp = 0 if im <= -4.5e+85: tmp = t_0 elif im <= -1.7e+31: tmp = math.pow(re, -512.0) elif im <= 0.0152: tmp = math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re))) tmp = 0.0 if (im <= -4.5e+85) tmp = t_0; elseif (im <= -1.7e+31) tmp = re ^ -512.0; elseif (im <= 0.0152) tmp = sin(re); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = re + ((im * im) * (0.5 * re)); tmp = 0.0; if (im <= -4.5e+85) tmp = t_0; elseif (im <= -1.7e+31) tmp = re ^ -512.0; elseif (im <= 0.0152) tmp = sin(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+85], t$95$0, If[LessEqual[im, -1.7e+31], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 0.0152], N[Sin[re], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.7 \cdot 10^{+31}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 0.0152:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.50000000000000007e85 or 0.0152 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 62.0%
Simplified62.0%
Taylor expanded in re around 0 61.8%
Taylor expanded in re around 0 41.2%
if -4.50000000000000007e85 < im < -1.6999999999999999e31Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 95.0%
Applied egg-rr50.4%
if -1.6999999999999999e31 < im < 0.0152Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 92.6%
Final simplification71.0%
(FPCore (re im) :precision binary64 (if (or (<= im -2.4e+29) (not (<= im 7e-5))) (+ re (* (* im im) (* 0.5 re))) (sin re)))
double code(double re, double im) {
double tmp;
if ((im <= -2.4e+29) || !(im <= 7e-5)) {
tmp = re + ((im * im) * (0.5 * re));
} else {
tmp = sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-2.4d+29)) .or. (.not. (im <= 7d-5))) then
tmp = re + ((im * im) * (0.5d0 * re))
else
tmp = sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -2.4e+29) || !(im <= 7e-5)) {
tmp = re + ((im * im) * (0.5 * re));
} else {
tmp = Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -2.4e+29) or not (im <= 7e-5): tmp = re + ((im * im) * (0.5 * re)) else: tmp = math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -2.4e+29) || !(im <= 7e-5)) tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re))); else tmp = sin(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -2.4e+29) || ~((im <= 7e-5))) tmp = re + ((im * im) * (0.5 * re)); else tmp = sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -2.4e+29], N[Not[LessEqual[im, 7e-5]], $MachinePrecision]], N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[re], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.4 \cdot 10^{+29} \lor \neg \left(im \leq 7 \cdot 10^{-5}\right):\\
\;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re\\
\end{array}
\end{array}
if im < -2.4000000000000001e29 or 6.9999999999999994e-5 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 51.0%
Simplified51.0%
Taylor expanded in re around 0 50.9%
Taylor expanded in re around 0 35.8%
if -2.4000000000000001e29 < im < 6.9999999999999994e-5Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 93.3%
Final simplification68.1%
(FPCore (re im) :precision binary64 (+ re (* (* im im) (* 0.5 re))))
double code(double re, double im) {
return re + ((im * im) * (0.5 * re));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + ((im * im) * (0.5d0 * re))
end function
public static double code(double re, double im) {
return re + ((im * im) * (0.5 * re));
}
def code(re, im): return re + ((im * im) * (0.5 * re))
function code(re, im) return Float64(re + Float64(Float64(im * im) * Float64(0.5 * re))) end
function tmp = code(re, im) tmp = re + ((im * im) * (0.5 * re)); end
code[re_, im_] := N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 74.8%
Simplified74.8%
Taylor expanded in re around 0 50.9%
Taylor expanded in re around 0 44.3%
Final simplification44.3%
(FPCore (re im) :precision binary64 64.0)
double code(double re, double im) {
return 64.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 64.0d0
end function
public static double code(double re, double im) {
return 64.0;
}
def code(re, im): return 64.0
function code(re, im) return 64.0 end
function tmp = code(re, im) tmp = 64.0; end
code[re_, im_] := 64.0
\begin{array}{l}
\\
64
\end{array}
Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 74.8%
Simplified74.8%
Applied egg-rr4.1%
Taylor expanded in re around 0 4.1%
Final simplification4.1%
(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 61.0%
Taylor expanded in im around 0 29.7%
Final simplification29.7%
herbie shell --seed 2023193
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))