
(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 17 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 (+ 2.0 (* im im)))
(t_1 (* (* 0.5 (sin re)) t_0))
(t_2 (+ (exp (- im)) (exp im))))
(if (<= im -1.35e+154)
t_1
(if (<= im -6.8e+121)
(* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0)
(if (<= im -1.3e+81)
(* t_2 -0.5)
(if (or (<= im -450.0) (and (not (<= im 350.0)) (<= im 5.5e+133)))
(* t_2 131072.0)
t_1))))))
double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (0.5 * sin(re)) * t_0;
double t_2 = exp(-im) + exp(im);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -6.8e+121) {
tmp = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
} else if (im <= -1.3e+81) {
tmp = t_2 * -0.5;
} else if ((im <= -450.0) || (!(im <= 350.0) && (im <= 5.5e+133))) {
tmp = t_2 * 131072.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) :: t_2
real(8) :: tmp
t_0 = 2.0d0 + (im * im)
t_1 = (0.5d0 * sin(re)) * t_0
t_2 = exp(-im) + exp(im)
if (im <= (-1.35d+154)) then
tmp = t_1
else if (im <= (-6.8d+121)) then
tmp = (t_0 + ((im ** 4.0d0) * 0.08333333333333333d0)) * 131072.0d0
else if (im <= (-1.3d+81)) then
tmp = t_2 * (-0.5d0)
else if ((im <= (-450.0d0)) .or. (.not. (im <= 350.0d0)) .and. (im <= 5.5d+133)) then
tmp = t_2 * 131072.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (0.5 * Math.sin(re)) * t_0;
double t_2 = Math.exp(-im) + Math.exp(im);
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -6.8e+121) {
tmp = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
} else if (im <= -1.3e+81) {
tmp = t_2 * -0.5;
} else if ((im <= -450.0) || (!(im <= 350.0) && (im <= 5.5e+133))) {
tmp = t_2 * 131072.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 2.0 + (im * im) t_1 = (0.5 * math.sin(re)) * t_0 t_2 = math.exp(-im) + math.exp(im) tmp = 0 if im <= -1.35e+154: tmp = t_1 elif im <= -6.8e+121: tmp = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0 elif im <= -1.3e+81: tmp = t_2 * -0.5 elif (im <= -450.0) or (not (im <= 350.0) and (im <= 5.5e+133)): tmp = t_2 * 131072.0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(2.0 + Float64(im * im)) t_1 = Float64(Float64(0.5 * sin(re)) * t_0) t_2 = Float64(exp(Float64(-im)) + exp(im)) tmp = 0.0 if (im <= -1.35e+154) tmp = t_1; elseif (im <= -6.8e+121) tmp = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0); elseif (im <= -1.3e+81) tmp = Float64(t_2 * -0.5); elseif ((im <= -450.0) || (!(im <= 350.0) && (im <= 5.5e+133))) tmp = Float64(t_2 * 131072.0); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 2.0 + (im * im); t_1 = (0.5 * sin(re)) * t_0; t_2 = exp(-im) + exp(im); tmp = 0.0; if (im <= -1.35e+154) tmp = t_1; elseif (im <= -6.8e+121) tmp = (t_0 + ((im ^ 4.0) * 0.08333333333333333)) * 131072.0; elseif (im <= -1.3e+81) tmp = t_2 * -0.5; elseif ((im <= -450.0) || (~((im <= 350.0)) && (im <= 5.5e+133))) tmp = t_2 * 131072.0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -6.8e+121], N[(N[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision], If[LessEqual[im, -1.3e+81], N[(t$95$2 * -0.5), $MachinePrecision], If[Or[LessEqual[im, -450.0], And[N[Not[LessEqual[im, 350.0]], $MachinePrecision], LessEqual[im, 5.5e+133]]], N[(t$95$2 * 131072.0), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := \left(0.5 \cdot \sin re\right) \cdot t_0\\
t_2 := e^{-im} + e^{im}\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -6.8 \cdot 10^{+121}:\\
\;\;\;\;\left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\
\mathbf{elif}\;im \leq -1.3 \cdot 10^{+81}:\\
\;\;\;\;t_2 \cdot -0.5\\
\mathbf{elif}\;im \leq -450 \lor \neg \left(im \leq 350\right) \land im \leq 5.5 \cdot 10^{+133}:\\
\;\;\;\;t_2 \cdot 131072\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or -450 < im < 350 or 5.5e133 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.7%
Simplified97.7%
if -1.35000000000000003e154 < im < -6.80000000000000021e121Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr88.9%
Taylor expanded in im around 0 88.9%
Simplified88.9%
if -6.80000000000000021e121 < im < -1.29999999999999996e81Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr100.0%
if -1.29999999999999996e81 < im < -450 or 350 < im < 5.5e133Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr62.5%
Final simplification91.9%
(FPCore (re im)
:precision binary64
(if (or (<= re -0.075) (not (<= re 4.2e-34)))
(*
(* 0.5 (sin re))
(+ (+ 2.0 (* im im)) (* (pow im 4.0) 0.08333333333333333)))
(* (+ (exp (- im)) (exp im)) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if ((re <= -0.075) || !(re <= 4.2e-34)) {
tmp = (0.5 * sin(re)) * ((2.0 + (im * im)) + (pow(im, 4.0) * 0.08333333333333333));
} else {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-0.075d0)) .or. (.not. (re <= 4.2d-34))) then
tmp = (0.5d0 * sin(re)) * ((2.0d0 + (im * im)) + ((im ** 4.0d0) * 0.08333333333333333d0))
else
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -0.075) || !(re <= 4.2e-34)) {
tmp = (0.5 * Math.sin(re)) * ((2.0 + (im * im)) + (Math.pow(im, 4.0) * 0.08333333333333333));
} else {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -0.075) or not (re <= 4.2e-34): tmp = (0.5 * math.sin(re)) * ((2.0 + (im * im)) + (math.pow(im, 4.0) * 0.08333333333333333)) else: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if ((re <= -0.075) || !(re <= 4.2e-34)) tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(2.0 + Float64(im * im)) + Float64((im ^ 4.0) * 0.08333333333333333))); else tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -0.075) || ~((re <= 4.2e-34))) tmp = (0.5 * sin(re)) * ((2.0 + (im * im)) + ((im ^ 4.0) * 0.08333333333333333)); else tmp = (exp(-im) + exp(im)) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -0.075], N[Not[LessEqual[re, 4.2e-34]], $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[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.075 \lor \neg \left(re \leq 4.2 \cdot 10^{-34}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(2 + im \cdot im\right) + {im}^{4} \cdot 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if re < -0.0749999999999999972 or 4.2000000000000002e-34 < re Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 90.0%
Simplified90.0%
if -0.0749999999999999972 < re < 4.2000000000000002e-34Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Final simplification94.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 2.0 (* im im)))
(t_1 (* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0))
(t_2 (* (* 0.5 (sin re)) t_0))
(t_3 (* (+ (exp (- im)) (exp im)) -0.5)))
(if (<= im -1.35e+154)
t_2
(if (<= im -9.5e+121)
t_1
(if (<= im -17.0)
t_3
(if (<= im 1650000000000.0)
t_2
(if (<= im 5e+76) t_3 (if (<= im 5.5e+133) t_1 t_2))))))))
double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
double t_2 = (0.5 * sin(re)) * t_0;
double t_3 = (exp(-im) + exp(im)) * -0.5;
double tmp;
if (im <= -1.35e+154) {
tmp = t_2;
} else if (im <= -9.5e+121) {
tmp = t_1;
} else if (im <= -17.0) {
tmp = t_3;
} else if (im <= 1650000000000.0) {
tmp = t_2;
} else if (im <= 5e+76) {
tmp = t_3;
} else if (im <= 5.5e+133) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 2.0d0 + (im * im)
t_1 = (t_0 + ((im ** 4.0d0) * 0.08333333333333333d0)) * 131072.0d0
t_2 = (0.5d0 * sin(re)) * t_0
t_3 = (exp(-im) + exp(im)) * (-0.5d0)
if (im <= (-1.35d+154)) then
tmp = t_2
else if (im <= (-9.5d+121)) then
tmp = t_1
else if (im <= (-17.0d0)) then
tmp = t_3
else if (im <= 1650000000000.0d0) then
tmp = t_2
else if (im <= 5d+76) then
tmp = t_3
else if (im <= 5.5d+133) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
double t_2 = (0.5 * Math.sin(re)) * t_0;
double t_3 = (Math.exp(-im) + Math.exp(im)) * -0.5;
double tmp;
if (im <= -1.35e+154) {
tmp = t_2;
} else if (im <= -9.5e+121) {
tmp = t_1;
} else if (im <= -17.0) {
tmp = t_3;
} else if (im <= 1650000000000.0) {
tmp = t_2;
} else if (im <= 5e+76) {
tmp = t_3;
} else if (im <= 5.5e+133) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = 2.0 + (im * im) t_1 = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0 t_2 = (0.5 * math.sin(re)) * t_0 t_3 = (math.exp(-im) + math.exp(im)) * -0.5 tmp = 0 if im <= -1.35e+154: tmp = t_2 elif im <= -9.5e+121: tmp = t_1 elif im <= -17.0: tmp = t_3 elif im <= 1650000000000.0: tmp = t_2 elif im <= 5e+76: tmp = t_3 elif im <= 5.5e+133: tmp = t_1 else: tmp = t_2 return tmp
function code(re, im) t_0 = Float64(2.0 + Float64(im * im)) t_1 = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0) t_2 = Float64(Float64(0.5 * sin(re)) * t_0) t_3 = Float64(Float64(exp(Float64(-im)) + exp(im)) * -0.5) tmp = 0.0 if (im <= -1.35e+154) tmp = t_2; elseif (im <= -9.5e+121) tmp = t_1; elseif (im <= -17.0) tmp = t_3; elseif (im <= 1650000000000.0) tmp = t_2; elseif (im <= 5e+76) tmp = t_3; elseif (im <= 5.5e+133) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(re, im) t_0 = 2.0 + (im * im); t_1 = (t_0 + ((im ^ 4.0) * 0.08333333333333333)) * 131072.0; t_2 = (0.5 * sin(re)) * t_0; t_3 = (exp(-im) + exp(im)) * -0.5; tmp = 0.0; if (im <= -1.35e+154) tmp = t_2; elseif (im <= -9.5e+121) tmp = t_1; elseif (im <= -17.0) tmp = t_3; elseif (im <= 1650000000000.0) tmp = t_2; elseif (im <= 5e+76) tmp = t_3; elseif (im <= 5.5e+133) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -9.5e+121], t$95$1, If[LessEqual[im, -17.0], t$95$3, If[LessEqual[im, 1650000000000.0], t$95$2, If[LessEqual[im, 5e+76], t$95$3, If[LessEqual[im, 5.5e+133], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := \left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\
t_2 := \left(0.5 \cdot \sin re\right) \cdot t_0\\
t_3 := \left(e^{-im} + e^{im}\right) \cdot -0.5\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -9.5 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -17:\\
\;\;\;\;t_3\\
\mathbf{elif}\;im \leq 1650000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;im \leq 5.5 \cdot 10^{+133}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or -17 < im < 1.65e12 or 5.5e133 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 97.7%
Simplified97.7%
if -1.35000000000000003e154 < im < -9.49999999999999949e121 or 4.99999999999999991e76 < im < 5.5e133Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr93.8%
Taylor expanded in im around 0 93.8%
Simplified93.8%
if -9.49999999999999949e121 < im < -17 or 1.65e12 < im < 4.99999999999999991e76Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr53.3%
Final simplification90.8%
(FPCore (re im)
:precision binary64
(if (or (<= im -1.35e+154)
(not (or (<= im -18.0) (and (not (<= im 0.115)) (<= im 1.35e+154)))))
(* (* 0.5 (sin re)) (+ 2.0 (* im im)))
(* (+ (exp (- im)) (exp im)) (* 0.5 re))))
double code(double re, double im) {
double tmp;
if ((im <= -1.35e+154) || !((im <= -18.0) || (!(im <= 0.115) && (im <= 1.35e+154)))) {
tmp = (0.5 * sin(re)) * (2.0 + (im * im));
} else {
tmp = (exp(-im) + exp(im)) * (0.5 * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1.35d+154)) .or. (.not. (im <= (-18.0d0)) .or. (.not. (im <= 0.115d0)) .and. (im <= 1.35d+154))) then
tmp = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
else
tmp = (exp(-im) + exp(im)) * (0.5d0 * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.35e+154) || !((im <= -18.0) || (!(im <= 0.115) && (im <= 1.35e+154)))) {
tmp = (0.5 * Math.sin(re)) * (2.0 + (im * im));
} else {
tmp = (Math.exp(-im) + Math.exp(im)) * (0.5 * re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.35e+154) or not ((im <= -18.0) or (not (im <= 0.115) and (im <= 1.35e+154))): tmp = (0.5 * math.sin(re)) * (2.0 + (im * im)) else: tmp = (math.exp(-im) + math.exp(im)) * (0.5 * re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.35e+154) || !((im <= -18.0) || (!(im <= 0.115) && (im <= 1.35e+154)))) tmp = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))); else tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.35e+154) || ~(((im <= -18.0) || (~((im <= 0.115)) && (im <= 1.35e+154))))) tmp = (0.5 * sin(re)) * (2.0 + (im * im)); else tmp = (exp(-im) + exp(im)) * (0.5 * re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.35e+154], N[Not[Or[LessEqual[im, -18.0], And[N[Not[LessEqual[im, 0.115]], $MachinePrecision], LessEqual[im, 1.35e+154]]]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154} \lor \neg \left(im \leq -18 \lor \neg \left(im \leq 0.115\right) \land im \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or -18 < im < 0.115000000000000005 or 1.35000000000000003e154 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 99.1%
Simplified99.1%
if -1.35000000000000003e154 < im < -18 or 0.115000000000000005 < im < 1.35000000000000003e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.4%
Final simplification93.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (+ (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* 0.5 (sin re)))
(t_2 (* t_1 (+ 2.0 (* im im)))))
(if (<= im -1.35e+154)
t_2
(if (<= im -18.0)
t_0
(if (<= im 0.165)
(+ (sin re) (* t_1 (* im im)))
(if (<= im 1.35e+154) t_0 t_2))))))
double code(double re, double im) {
double t_0 = (exp(-im) + exp(im)) * (0.5 * re);
double t_1 = 0.5 * sin(re);
double t_2 = t_1 * (2.0 + (im * im));
double tmp;
if (im <= -1.35e+154) {
tmp = t_2;
} else if (im <= -18.0) {
tmp = t_0;
} else if (im <= 0.165) {
tmp = sin(re) + (t_1 * (im * im));
} else if (im <= 1.35e+154) {
tmp = t_0;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = (exp(-im) + exp(im)) * (0.5d0 * re)
t_1 = 0.5d0 * sin(re)
t_2 = t_1 * (2.0d0 + (im * im))
if (im <= (-1.35d+154)) then
tmp = t_2
else if (im <= (-18.0d0)) then
tmp = t_0
else if (im <= 0.165d0) then
tmp = sin(re) + (t_1 * (im * im))
else if (im <= 1.35d+154) then
tmp = t_0
else
tmp = t_2
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 = 0.5 * Math.sin(re);
double t_2 = t_1 * (2.0 + (im * im));
double tmp;
if (im <= -1.35e+154) {
tmp = t_2;
} else if (im <= -18.0) {
tmp = t_0;
} else if (im <= 0.165) {
tmp = Math.sin(re) + (t_1 * (im * im));
} else if (im <= 1.35e+154) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) + math.exp(im)) * (0.5 * re) t_1 = 0.5 * math.sin(re) t_2 = t_1 * (2.0 + (im * im)) tmp = 0 if im <= -1.35e+154: tmp = t_2 elif im <= -18.0: tmp = t_0 elif im <= 0.165: tmp = math.sin(re) + (t_1 * (im * im)) elif im <= 1.35e+154: tmp = t_0 else: tmp = t_2 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * re)) t_1 = Float64(0.5 * sin(re)) t_2 = Float64(t_1 * Float64(2.0 + Float64(im * im))) tmp = 0.0 if (im <= -1.35e+154) tmp = t_2; elseif (im <= -18.0) tmp = t_0; elseif (im <= 0.165) tmp = Float64(sin(re) + Float64(t_1 * Float64(im * im))); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) + exp(im)) * (0.5 * re); t_1 = 0.5 * sin(re); t_2 = t_1 * (2.0 + (im * im)); tmp = 0.0; if (im <= -1.35e+154) tmp = t_2; elseif (im <= -18.0) tmp = t_0; elseif (im <= 0.165) tmp = sin(re) + (t_1 * (im * im)); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_2; 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[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -18.0], t$95$0, If[LessEqual[im, 0.165], N[(N[Sin[re], $MachinePrecision] + N[(t$95$1 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := 0.5 \cdot \sin re\\
t_2 := t_1 \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -18:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.165:\\
\;\;\;\;\sin re + t_1 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or 1.35000000000000003e154 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
if -1.35000000000000003e154 < im < -18 or 0.165000000000000008 < im < 1.35000000000000003e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 75.4%
if -18 < im < 0.165000000000000008Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.6%
Simplified98.6%
Final simplification93.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 2.0 (* im im))) (t_1 (* (* 0.5 (sin re)) t_0)))
(if (<= im -1.35e+154)
t_1
(if (<= im -4350000000000.0)
(log1p (expm1 (/ 0.25 (* re re))))
(if (or (<= im 2.45e+76) (not (<= im 5.5e+133)))
t_1
(* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0))))))
double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (0.5 * sin(re)) * t_0;
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -4350000000000.0) {
tmp = log1p(expm1((0.25 / (re * re))));
} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
tmp = t_1;
} else {
tmp = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (0.5 * Math.sin(re)) * t_0;
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -4350000000000.0) {
tmp = Math.log1p(Math.expm1((0.25 / (re * re))));
} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
tmp = t_1;
} else {
tmp = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
}
return tmp;
}
def code(re, im): t_0 = 2.0 + (im * im) t_1 = (0.5 * math.sin(re)) * t_0 tmp = 0 if im <= -1.35e+154: tmp = t_1 elif im <= -4350000000000.0: tmp = math.log1p(math.expm1((0.25 / (re * re)))) elif (im <= 2.45e+76) or not (im <= 5.5e+133): tmp = t_1 else: tmp = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0 return tmp
function code(re, im) t_0 = Float64(2.0 + Float64(im * im)) t_1 = Float64(Float64(0.5 * sin(re)) * t_0) tmp = 0.0 if (im <= -1.35e+154) tmp = t_1; elseif (im <= -4350000000000.0) tmp = log1p(expm1(Float64(0.25 / Float64(re * re)))); elseif ((im <= 2.45e+76) || !(im <= 5.5e+133)) tmp = t_1; else tmp = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -4350000000000.0], N[Log[1 + N[(Exp[N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[im, 2.45e+76], N[Not[LessEqual[im, 5.5e+133]], $MachinePrecision]], t$95$1, N[(N[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := \left(0.5 \cdot \sin re\right) \cdot t_0\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -4350000000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{re \cdot re}\right)\right)\\
\mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or -4.35e12 < im < 2.45000000000000013e76 or 5.5e133 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 91.2%
Simplified91.2%
if -1.35000000000000003e154 < im < -4.35e12Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr20.7%
Taylor expanded in re around 0 20.6%
unpow220.6%
Simplified20.6%
add-sqr-sqrt20.6%
sqrt-unprod29.1%
frac-times29.1%
metadata-eval29.1%
pow229.1%
metadata-eval29.1%
pow-prod-down29.1%
pow-prod-up29.1%
metadata-eval29.1%
metadata-eval29.1%
metadata-eval29.1%
Applied egg-rr29.1%
log1p-expm1-u38.1%
sqrt-div38.1%
metadata-eval38.1%
sqrt-pow138.1%
metadata-eval38.1%
pow238.1%
Applied egg-rr38.1%
if 2.45000000000000013e76 < im < 5.5e133Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Final simplification84.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 2.0 (* im im)))
(t_1 (* (+ t_0 (* (pow im 4.0) 0.08333333333333333)) 131072.0))
(t_2 (* (* 0.5 (sin re)) t_0)))
(if (<= im -1.35e+154)
t_2
(if (<= im -2.25e+64)
t_1
(if (<= im -8e+24)
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
(if (or (<= im 2.45e+76) (not (<= im 5.5e+133))) t_2 t_1))))))
double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (t_0 + (pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
double t_2 = (0.5 * sin(re)) * t_0;
double tmp;
if (im <= -1.35e+154) {
tmp = t_2;
} else if (im <= -2.25e+64) {
tmp = t_1;
} else if (im <= -8e+24) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_0 = 2.0d0 + (im * im)
t_1 = (t_0 + ((im ** 4.0d0) * 0.08333333333333333d0)) * 131072.0d0
t_2 = (0.5d0 * sin(re)) * t_0
if (im <= (-1.35d+154)) then
tmp = t_2
else if (im <= (-2.25d+64)) then
tmp = t_1
else if (im <= (-8d+24)) then
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
else if ((im <= 2.45d+76) .or. (.not. (im <= 5.5d+133))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 2.0 + (im * im);
double t_1 = (t_0 + (Math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0;
double t_2 = (0.5 * Math.sin(re)) * t_0;
double tmp;
if (im <= -1.35e+154) {
tmp = t_2;
} else if (im <= -2.25e+64) {
tmp = t_1;
} else if (im <= -8e+24) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else if ((im <= 2.45e+76) || !(im <= 5.5e+133)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 2.0 + (im * im) t_1 = (t_0 + (math.pow(im, 4.0) * 0.08333333333333333)) * 131072.0 t_2 = (0.5 * math.sin(re)) * t_0 tmp = 0 if im <= -1.35e+154: tmp = t_2 elif im <= -2.25e+64: tmp = t_1 elif im <= -8e+24: tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) elif (im <= 2.45e+76) or not (im <= 5.5e+133): tmp = t_2 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(2.0 + Float64(im * im)) t_1 = Float64(Float64(t_0 + Float64((im ^ 4.0) * 0.08333333333333333)) * 131072.0) t_2 = Float64(Float64(0.5 * sin(re)) * t_0) tmp = 0.0 if (im <= -1.35e+154) tmp = t_2; elseif (im <= -2.25e+64) tmp = t_1; elseif (im <= -8e+24) tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); elseif ((im <= 2.45e+76) || !(im <= 5.5e+133)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 2.0 + (im * im); t_1 = (t_0 + ((im ^ 4.0) * 0.08333333333333333)) * 131072.0; t_2 = (0.5 * sin(re)) * t_0; tmp = 0.0; if (im <= -1.35e+154) tmp = t_2; elseif (im <= -2.25e+64) tmp = t_1; elseif (im <= -8e+24) tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); elseif ((im <= 2.45e+76) || ~((im <= 5.5e+133))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$2, If[LessEqual[im, -2.25e+64], t$95$1, If[LessEqual[im, -8e+24], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 2.45e+76], N[Not[LessEqual[im, 5.5e+133]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 + im \cdot im\\
t_1 := \left(t_0 + {im}^{4} \cdot 0.08333333333333333\right) \cdot 131072\\
t_2 := \left(0.5 \cdot \sin re\right) \cdot t_0\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -2.25 \cdot 10^{+64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -8 \cdot 10^{+24}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 2.45 \cdot 10^{+76} \lor \neg \left(im \leq 5.5 \cdot 10^{+133}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or -7.9999999999999999e24 < im < 2.45000000000000013e76 or 5.5e133 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 89.6%
Simplified89.6%
if -1.35000000000000003e154 < im < -2.24999999999999987e64 or 2.45000000000000013e76 < im < 5.5e133Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr73.9%
Taylor expanded in im around 0 69.9%
Simplified69.9%
if -2.24999999999999987e64 < im < -7.9999999999999999e24Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr26.6%
Taylor expanded in re around 0 43.1%
associate-*r/43.1%
metadata-eval43.1%
unpow243.1%
*-commutative43.1%
unpow243.1%
Simplified43.1%
Final simplification85.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (/ 0.25 (* re re))) (t_1 (* (* 0.5 (sin re)) (+ 2.0 (* im im)))))
(if (<= im -1.35e+154)
t_1
(if (<= im -9.5e+30)
(sqrt (* t_0 t_0))
(if (or (<= im 1650000000000.0) (not (<= im 9.5e+144)))
t_1
(+
re
(* im (* (* re im) (+ 0.5 (* (* re re) -0.08333333333333333))))))))))
double code(double re, double im) {
double t_0 = 0.25 / (re * re);
double t_1 = (0.5 * sin(re)) * (2.0 + (im * im));
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -9.5e+30) {
tmp = sqrt((t_0 * t_0));
} else if ((im <= 1650000000000.0) || !(im <= 9.5e+144)) {
tmp = t_1;
} else {
tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
}
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 = 0.25d0 / (re * re)
t_1 = (0.5d0 * sin(re)) * (2.0d0 + (im * im))
if (im <= (-1.35d+154)) then
tmp = t_1
else if (im <= (-9.5d+30)) then
tmp = sqrt((t_0 * t_0))
else if ((im <= 1650000000000.0d0) .or. (.not. (im <= 9.5d+144))) then
tmp = t_1
else
tmp = re + (im * ((re * im) * (0.5d0 + ((re * re) * (-0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.25 / (re * re);
double t_1 = (0.5 * Math.sin(re)) * (2.0 + (im * im));
double tmp;
if (im <= -1.35e+154) {
tmp = t_1;
} else if (im <= -9.5e+30) {
tmp = Math.sqrt((t_0 * t_0));
} else if ((im <= 1650000000000.0) || !(im <= 9.5e+144)) {
tmp = t_1;
} else {
tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
}
return tmp;
}
def code(re, im): t_0 = 0.25 / (re * re) t_1 = (0.5 * math.sin(re)) * (2.0 + (im * im)) tmp = 0 if im <= -1.35e+154: tmp = t_1 elif im <= -9.5e+30: tmp = math.sqrt((t_0 * t_0)) elif (im <= 1650000000000.0) or not (im <= 9.5e+144): tmp = t_1 else: tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333)))) return tmp
function code(re, im) t_0 = Float64(0.25 / Float64(re * re)) t_1 = Float64(Float64(0.5 * sin(re)) * Float64(2.0 + Float64(im * im))) tmp = 0.0 if (im <= -1.35e+154) tmp = t_1; elseif (im <= -9.5e+30) tmp = sqrt(Float64(t_0 * t_0)); elseif ((im <= 1650000000000.0) || !(im <= 9.5e+144)) tmp = t_1; else tmp = Float64(re + Float64(im * Float64(Float64(re * im) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.25 / (re * re); t_1 = (0.5 * sin(re)) * (2.0 + (im * im)); tmp = 0.0; if (im <= -1.35e+154) tmp = t_1; elseif (im <= -9.5e+30) tmp = sqrt((t_0 * t_0)); elseif ((im <= 1650000000000.0) || ~((im <= 9.5e+144))) tmp = t_1; else tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.35e+154], t$95$1, If[LessEqual[im, -9.5e+30], N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[im, 1650000000000.0], N[Not[LessEqual[im, 9.5e+144]], $MachinePrecision]], t$95$1, N[(re + N[(im * N[(N[(re * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.25}{re \cdot re}\\
t_1 := \left(0.5 \cdot \sin re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;\sqrt{t_0 \cdot t_0}\\
\mathbf{elif}\;im \leq 1650000000000 \lor \neg \left(im \leq 9.5 \cdot 10^{+144}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if im < -1.35000000000000003e154 or -9.5000000000000003e30 < im < 1.65e12 or 9.50000000000000031e144 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 94.5%
Simplified94.5%
if -1.35000000000000003e154 < im < -9.5000000000000003e30Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr25.2%
Taylor expanded in re around 0 25.0%
unpow225.0%
Simplified25.0%
add-sqr-sqrt25.0%
sqrt-unprod35.5%
frac-times35.5%
metadata-eval35.5%
pow235.5%
metadata-eval35.5%
pow-prod-down35.5%
pow-prod-up35.5%
metadata-eval35.5%
metadata-eval35.5%
metadata-eval35.5%
Applied egg-rr35.5%
add-sqr-sqrt35.5%
sqrt-div35.5%
metadata-eval35.5%
sqrt-pow135.5%
metadata-eval35.5%
pow235.5%
sqrt-div35.5%
metadata-eval35.5%
sqrt-pow135.5%
metadata-eval35.5%
pow235.5%
Applied egg-rr35.5%
if 1.65e12 < im < 9.50000000000000031e144Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.4%
Simplified4.4%
Taylor expanded in re around 0 16.0%
associate-*r*16.0%
unpow216.0%
associate-*r*16.0%
associate-*r*16.0%
unpow216.0%
associate-*r*16.0%
distribute-rgt-out30.3%
unpow330.3%
unpow230.3%
associate-*r*30.3%
associate-*l*30.3%
associate-*l*30.3%
distribute-rgt-out35.0%
*-commutative35.0%
unpow235.0%
Simplified35.0%
Taylor expanded in re around 0 35.0%
Final simplification83.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 78.0%
Simplified78.0%
Final simplification78.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ re (* (* im im) (* 0.5 re)))))
(if (<= im -1.5e+137)
t_0
(if (<= im -8e+24)
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666)))
(if (<= im 6.9e-18)
(sin re)
(if (<= im 1.05e+132)
(+
re
(* im (* (* re im) (+ 0.5 (* (* re re) -0.08333333333333333)))))
t_0))))))
double code(double re, double im) {
double t_0 = re + ((im * im) * (0.5 * re));
double tmp;
if (im <= -1.5e+137) {
tmp = t_0;
} else if (im <= -8e+24) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else if (im <= 6.9e-18) {
tmp = sin(re);
} else if (im <= 1.05e+132) {
tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
} 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 <= (-1.5d+137)) then
tmp = t_0
else if (im <= (-8d+24)) then
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
else if (im <= 6.9d-18) then
tmp = sin(re)
else if (im <= 1.05d+132) then
tmp = re + (im * ((re * im) * (0.5d0 + ((re * re) * (-0.08333333333333333d0)))))
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 <= -1.5e+137) {
tmp = t_0;
} else if (im <= -8e+24) {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
} else if (im <= 6.9e-18) {
tmp = Math.sin(re);
} else if (im <= 1.05e+132) {
tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = re + ((im * im) * (0.5 * re)) tmp = 0 if im <= -1.5e+137: tmp = t_0 elif im <= -8e+24: tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) elif im <= 6.9e-18: tmp = math.sin(re) elif im <= 1.05e+132: tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333)))) 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 <= -1.5e+137) tmp = t_0; elseif (im <= -8e+24) tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); elseif (im <= 6.9e-18) tmp = sin(re); elseif (im <= 1.05e+132) tmp = Float64(re + Float64(im * Float64(Float64(re * im) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))))); 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 <= -1.5e+137) tmp = t_0; elseif (im <= -8e+24) tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); elseif (im <= 6.9e-18) tmp = sin(re); elseif (im <= 1.05e+132) tmp = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333)))); 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, -1.5e+137], t$95$0, If[LessEqual[im, -8e+24], N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.9e-18], N[Sin[re], $MachinePrecision], If[LessEqual[im, 1.05e+132], N[(re + N[(im * N[(N[(re * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -1.5 \cdot 10^{+137}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8 \cdot 10^{+24}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 6.9 \cdot 10^{-18}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 1.05 \cdot 10^{+132}:\\
\;\;\;\;re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.5e137 or 1.04999999999999997e132 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.8%
Simplified88.8%
Taylor expanded in re around 0 69.2%
associate-*r*69.2%
unpow269.2%
Simplified69.2%
Taylor expanded in re around 0 69.2%
if -1.5e137 < im < -7.9999999999999999e24Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr24.5%
Taylor expanded in re around 0 33.4%
associate-*r/33.4%
metadata-eval33.4%
unpow233.4%
*-commutative33.4%
unpow233.4%
Simplified33.4%
if -7.9999999999999999e24 < im < 6.9000000000000003e-18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 94.4%
if 6.9000000000000003e-18 < im < 1.04999999999999997e132Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in im around 0 18.8%
Simplified18.8%
Taylor expanded in re around 0 26.4%
associate-*r*26.4%
unpow226.4%
associate-*r*26.4%
associate-*r*26.4%
unpow226.4%
associate-*r*26.4%
distribute-rgt-out38.9%
unpow338.9%
unpow238.9%
associate-*r*38.9%
associate-*l*38.9%
associate-*l*38.9%
distribute-rgt-out38.9%
*-commutative38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in re around 0 38.9%
Final simplification76.7%
(FPCore (re im)
:precision binary64
(let* ((t_0
(+
re
(* im (* (* re im) (+ 0.5 (* (* re re) -0.08333333333333333)))))))
(if (<= re -1.05e+32)
t_0
(if (<= re 8.4e+94)
(+ re (* (* im im) (* 0.5 re)))
(if (<= re 6.5e+253)
t_0
(+
0.08333333333333333
(+ (/ 0.25 (* re re)) (* (* re re) 0.016666666666666666))))))))
double code(double re, double im) {
double t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
double tmp;
if (re <= -1.05e+32) {
tmp = t_0;
} else if (re <= 8.4e+94) {
tmp = re + ((im * im) * (0.5 * re));
} else if (re <= 6.5e+253) {
tmp = t_0;
} else {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
}
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 * ((re * im) * (0.5d0 + ((re * re) * (-0.08333333333333333d0)))))
if (re <= (-1.05d+32)) then
tmp = t_0
else if (re <= 8.4d+94) then
tmp = re + ((im * im) * (0.5d0 * re))
else if (re <= 6.5d+253) then
tmp = t_0
else
tmp = 0.08333333333333333d0 + ((0.25d0 / (re * re)) + ((re * re) * 0.016666666666666666d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333))));
double tmp;
if (re <= -1.05e+32) {
tmp = t_0;
} else if (re <= 8.4e+94) {
tmp = re + ((im * im) * (0.5 * re));
} else if (re <= 6.5e+253) {
tmp = t_0;
} else {
tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666));
}
return tmp;
}
def code(re, im): t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333)))) tmp = 0 if re <= -1.05e+32: tmp = t_0 elif re <= 8.4e+94: tmp = re + ((im * im) * (0.5 * re)) elif re <= 6.5e+253: tmp = t_0 else: tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)) return tmp
function code(re, im) t_0 = Float64(re + Float64(im * Float64(Float64(re * im) * Float64(0.5 + Float64(Float64(re * re) * -0.08333333333333333))))) tmp = 0.0 if (re <= -1.05e+32) tmp = t_0; elseif (re <= 8.4e+94) tmp = Float64(re + Float64(Float64(im * im) * Float64(0.5 * re))); elseif (re <= 6.5e+253) tmp = t_0; else tmp = Float64(0.08333333333333333 + Float64(Float64(0.25 / Float64(re * re)) + Float64(Float64(re * re) * 0.016666666666666666))); end return tmp end
function tmp_2 = code(re, im) t_0 = re + (im * ((re * im) * (0.5 + ((re * re) * -0.08333333333333333)))); tmp = 0.0; if (re <= -1.05e+32) tmp = t_0; elseif (re <= 8.4e+94) tmp = re + ((im * im) * (0.5 * re)); elseif (re <= 6.5e+253) tmp = t_0; else tmp = 0.08333333333333333 + ((0.25 / (re * re)) + ((re * re) * 0.016666666666666666)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re + N[(im * N[(N[(re * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1.05e+32], t$95$0, If[LessEqual[re, 8.4e+94], N[(re + N[(N[(im * im), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.5e+253], t$95$0, N[(0.08333333333333333 + N[(N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision] + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re + im \cdot \left(\left(re \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{if}\;re \leq -1.05 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 8.4 \cdot 10^{+94}:\\
\;\;\;\;re + \left(im \cdot im\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{elif}\;re \leq 6.5 \cdot 10^{+253}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \left(\frac{0.25}{re \cdot re} + \left(re \cdot re\right) \cdot 0.016666666666666666\right)\\
\end{array}
\end{array}
if re < -1.05e32 or 8.39999999999999958e94 < re < 6.5000000000000002e253Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.2%
Simplified79.2%
Taylor expanded in re around 0 10.6%
associate-*r*10.6%
unpow210.6%
associate-*r*11.1%
associate-*r*11.1%
unpow211.1%
associate-*r*11.1%
distribute-rgt-out17.2%
unpow317.2%
unpow217.2%
associate-*r*17.2%
associate-*l*24.9%
associate-*l*24.9%
distribute-rgt-out41.1%
*-commutative41.1%
unpow241.1%
Simplified41.1%
Taylor expanded in re around 0 29.4%
if -1.05e32 < re < 8.39999999999999958e94Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 76.8%
Simplified76.8%
Taylor expanded in re around 0 76.1%
associate-*r*76.1%
unpow276.1%
Simplified76.1%
Taylor expanded in re around 0 66.4%
if 6.5000000000000002e253 < re Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Applied egg-rr6.6%
Taylor expanded in re around 0 28.4%
associate-*r/28.4%
metadata-eval28.4%
unpow228.4%
*-commutative28.4%
unpow228.4%
Simplified28.4%
Final simplification50.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (+ 2.0 (* im im)) 131072.0)))
(if (<= im -4e+176)
t_0
(if (<= im -9.5e+30)
(+ 0.08333333333333333 (/ 0.25 (* re re)))
(if (<= im 7.2e+76) re t_0)))))
double code(double re, double im) {
double t_0 = (2.0 + (im * im)) * 131072.0;
double tmp;
if (im <= -4e+176) {
tmp = t_0;
} else if (im <= -9.5e+30) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else if (im <= 7.2e+76) {
tmp = 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 = (2.0d0 + (im * im)) * 131072.0d0
if (im <= (-4d+176)) then
tmp = t_0
else if (im <= (-9.5d+30)) then
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
else if (im <= 7.2d+76) then
tmp = re
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (2.0 + (im * im)) * 131072.0;
double tmp;
if (im <= -4e+176) {
tmp = t_0;
} else if (im <= -9.5e+30) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else if (im <= 7.2e+76) {
tmp = re;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (2.0 + (im * im)) * 131072.0 tmp = 0 if im <= -4e+176: tmp = t_0 elif im <= -9.5e+30: tmp = 0.08333333333333333 + (0.25 / (re * re)) elif im <= 7.2e+76: tmp = re else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(2.0 + Float64(im * im)) * 131072.0) tmp = 0.0 if (im <= -4e+176) tmp = t_0; elseif (im <= -9.5e+30) tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); elseif (im <= 7.2e+76) tmp = re; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (2.0 + (im * im)) * 131072.0; tmp = 0.0; if (im <= -4e+176) tmp = t_0; elseif (im <= -9.5e+30) tmp = 0.08333333333333333 + (0.25 / (re * re)); elseif (im <= 7.2e+76) tmp = re; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] * 131072.0), $MachinePrecision]}, If[LessEqual[im, -4e+176], t$95$0, If[LessEqual[im, -9.5e+30], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+76], re, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 + im \cdot im\right) \cdot 131072\\
\mathbf{if}\;im \leq -4 \cdot 10^{+176}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\mathbf{elif}\;im \leq 7.2 \cdot 10^{+76}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4e176 or 7.2000000000000006e76 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr100.0%
Applied egg-rr49.3%
Taylor expanded in im around 0 40.0%
Simplified40.0%
if -4e176 < im < -9.5000000000000003e30Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr21.9%
Taylor expanded in re around 0 21.9%
associate-*r/21.9%
metadata-eval21.9%
unpow221.9%
Simplified21.9%
if -9.5000000000000003e30 < im < 7.2000000000000006e76Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.8%
Taylor expanded in re around 0 40.1%
Final simplification37.9%
(FPCore (re im) :precision binary64 (if (<= im -2.6e+31) (+ 0.08333333333333333 (/ 0.25 (* re re))) re))
double code(double re, double im) {
double tmp;
if (im <= -2.6e+31) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} 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 <= (-2.6d+31)) then
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -2.6e+31) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2.6e+31: tmp = 0.08333333333333333 + (0.25 / (re * re)) else: tmp = re return tmp
function code(re, im) tmp = 0.0 if (im <= -2.6e+31) tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2.6e+31) tmp = 0.08333333333333333 + (0.25 / (re * re)); else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2.6e+31], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.6 \cdot 10^{+31}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -2.6e31Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr19.0%
Taylor expanded in re around 0 19.0%
associate-*r/19.0%
metadata-eval19.0%
unpow219.0%
Simplified19.0%
if -2.6e31 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 68.7%
Taylor expanded in re around 0 32.7%
Final simplification29.3%
(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 78.0%
Simplified78.0%
Taylor expanded in re around 0 66.1%
associate-*r*66.1%
unpow266.1%
Simplified66.1%
Taylor expanded in re around 0 45.2%
Final simplification45.2%
(FPCore (re im) :precision binary64 (if (<= im -6.5e+43) (/ 0.25 (* re re)) re))
double code(double re, double im) {
double tmp;
if (im <= -6.5e+43) {
tmp = 0.25 / (re * re);
} 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 <= (-6.5d+43)) then
tmp = 0.25d0 / (re * re)
else
tmp = re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -6.5e+43) {
tmp = 0.25 / (re * re);
} else {
tmp = re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -6.5e+43: tmp = 0.25 / (re * re) else: tmp = re return tmp
function code(re, im) tmp = 0.0 if (im <= -6.5e+43) tmp = Float64(0.25 / Float64(re * re)); else tmp = re; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -6.5e+43) tmp = 0.25 / (re * re); else tmp = re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -6.5e+43], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], re]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.5 \cdot 10^{+43}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;re\\
\end{array}
\end{array}
if im < -6.4999999999999998e43Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr19.8%
Taylor expanded in re around 0 19.7%
unpow219.7%
Simplified19.7%
if -6.4999999999999998e43 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.7%
Taylor expanded in re around 0 32.2%
Final simplification29.3%
(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 im around 0 52.4%
Taylor expanded in re around 0 25.2%
Final simplification25.2%
herbie shell --seed 2023187
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))