
(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 23 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 (* (sin re) (* 0.5 (+ (exp (- im)) (exp im)))))
double code(double re, double im) {
return sin(re) * (0.5 * (exp(-im) + exp(im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (0.5d0 * (exp(-im) + exp(im)))
end function
public static double code(double re, double im) {
return Math.sin(re) * (0.5 * (Math.exp(-im) + Math.exp(im)));
}
def code(re, im): return math.sin(re) * (0.5 * (math.exp(-im) + math.exp(im)))
function code(re, im) return Float64(sin(re) * Float64(0.5 * Float64(exp(Float64(-im)) + exp(im)))) end
function tmp = code(re, im) tmp = sin(re) * (0.5 * (exp(-im) + exp(im))); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(0.5 \cdot \left(e^{-im} + e^{im}\right)\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im 0.03)
(+ (sin re) (* 0.5 (* (sin re) (* im im))))
(if (<= im 1.75e+50)
(* (+ (exp (- im)) (exp im)) (* re 0.5))
(if (<= im 5e+76)
(* (log1p (expm1 (* (sin re) im))) (* 0.5 im))
(*
(sin re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))))
double code(double re, double im) {
double tmp;
if (im <= 0.03) {
tmp = sin(re) + (0.5 * (sin(re) * (im * im)));
} else if (im <= 1.75e+50) {
tmp = (exp(-im) + exp(im)) * (re * 0.5);
} else if (im <= 5e+76) {
tmp = log1p(expm1((sin(re) * im))) * (0.5 * im);
} else {
tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= 0.03) {
tmp = Math.sin(re) + (0.5 * (Math.sin(re) * (im * im)));
} else if (im <= 1.75e+50) {
tmp = (Math.exp(-im) + Math.exp(im)) * (re * 0.5);
} else if (im <= 5e+76) {
tmp = Math.log1p(Math.expm1((Math.sin(re) * im))) * (0.5 * im);
} else {
tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.03: tmp = math.sin(re) + (0.5 * (math.sin(re) * (im * im))) elif im <= 1.75e+50: tmp = (math.exp(-im) + math.exp(im)) * (re * 0.5) elif im <= 5e+76: tmp = math.log1p(math.expm1((math.sin(re) * im))) * (0.5 * im) else: tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.03) tmp = Float64(sin(re) + Float64(0.5 * Float64(sin(re) * Float64(im * im)))); elseif (im <= 1.75e+50) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(re * 0.5)); elseif (im <= 5e+76) tmp = Float64(log1p(expm1(Float64(sin(re) * im))) * Float64(0.5 * im)); else tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
code[re_, im_] := If[LessEqual[im, 0.03], N[(N[Sin[re], $MachinePrecision] + N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.75e+50], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5e+76], N[(N[Log[1 + N[(Exp[N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[(0.5 * im), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.03:\\
\;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 1.75 \cdot 10^{+50}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(re \cdot 0.5\right)\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+76}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re \cdot im\right)\right) \cdot \left(0.5 \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 0.029999999999999999Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.8%
unpow284.8%
Simplified84.8%
if 0.029999999999999999 < im < 1.75000000000000003e50Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 73.3%
associate-*r*73.3%
Simplified73.3%
if 1.75000000000000003e50 < im < 4.99999999999999991e76Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.9%
*-rgt-identity7.9%
*-commutative7.9%
associate-*r*7.9%
*-commutative7.9%
associate-*r*7.9%
distribute-rgt-out7.9%
distribute-lft-out7.9%
metadata-eval7.9%
pow-sqr7.9%
associate-*r*7.9%
distribute-rgt-out7.9%
unpow27.9%
unpow27.9%
Simplified7.9%
Taylor expanded in im around 0 4.0%
*-commutative4.0%
unpow24.0%
Simplified4.0%
Taylor expanded in im around inf 4.0%
*-commutative4.0%
unpow24.0%
associate-*r*4.0%
associate-*l*4.0%
*-commutative4.0%
Simplified4.0%
log1p-expm1-u75.6%
Applied egg-rr75.6%
if 4.99999999999999991e76 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
*-rgt-identity98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt-out98.3%
distribute-lft-out98.3%
metadata-eval98.3%
pow-sqr98.3%
associate-*r*98.3%
distribute-rgt-out98.3%
unpow298.3%
unpow298.3%
Simplified98.3%
Final simplification86.8%
(FPCore (re im)
:precision binary64
(if (<= im 0.08)
(* (sin re) (+ 1.0 (* im (* 0.5 im))))
(if (<= im 2.5e+77)
(* (+ (exp (- im)) (exp im)) (* re 0.5))
(*
(sin re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))))
double code(double re, double im) {
double tmp;
if (im <= 0.08) {
tmp = sin(re) * (1.0 + (im * (0.5 * im)));
} else if (im <= 2.5e+77) {
tmp = (exp(-im) + exp(im)) * (re * 0.5);
} else {
tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.08d0) then
tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
else if (im <= 2.5d+77) then
tmp = (exp(-im) + exp(im)) * (re * 0.5d0)
else
tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.08) {
tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
} else if (im <= 2.5e+77) {
tmp = (Math.exp(-im) + Math.exp(im)) * (re * 0.5);
} else {
tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.08: tmp = math.sin(re) * (1.0 + (im * (0.5 * im))) elif im <= 2.5e+77: tmp = (math.exp(-im) + math.exp(im)) * (re * 0.5) else: tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.08) tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im)))); elseif (im <= 2.5e+77) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(re * 0.5)); else tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.08) tmp = sin(re) * (1.0 + (im * (0.5 * im))); elseif (im <= 2.5e+77) tmp = (exp(-im) + exp(im)) * (re * 0.5); else tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.08], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.5e+77], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.08:\\
\;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(re \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 0.0800000000000000017Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.8%
*-commutative84.8%
associate-*r*84.8%
distribute-rgt1-in84.8%
*-commutative84.8%
unpow284.8%
associate-*l*84.8%
Simplified84.8%
if 0.0800000000000000017 < im < 2.50000000000000002e77Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 65.0%
associate-*r*65.0%
Simplified65.0%
if 2.50000000000000002e77 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-rgt-identity100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
metadata-eval100.0%
pow-sqr100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
unpow2100.0%
unpow2100.0%
Simplified100.0%
Final simplification86.4%
(FPCore (re im)
:precision binary64
(if (<= im 0.058)
(+ (sin re) (* 0.5 (* (sin re) (* im im))))
(if (<= im 2.5e+77)
(* (+ (exp (- im)) (exp im)) (* re 0.5))
(*
(sin re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))))
double code(double re, double im) {
double tmp;
if (im <= 0.058) {
tmp = sin(re) + (0.5 * (sin(re) * (im * im)));
} else if (im <= 2.5e+77) {
tmp = (exp(-im) + exp(im)) * (re * 0.5);
} else {
tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.058d0) then
tmp = sin(re) + (0.5d0 * (sin(re) * (im * im)))
else if (im <= 2.5d+77) then
tmp = (exp(-im) + exp(im)) * (re * 0.5d0)
else
tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.058) {
tmp = Math.sin(re) + (0.5 * (Math.sin(re) * (im * im)));
} else if (im <= 2.5e+77) {
tmp = (Math.exp(-im) + Math.exp(im)) * (re * 0.5);
} else {
tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.058: tmp = math.sin(re) + (0.5 * (math.sin(re) * (im * im))) elif im <= 2.5e+77: tmp = (math.exp(-im) + math.exp(im)) * (re * 0.5) else: tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.058) tmp = Float64(sin(re) + Float64(0.5 * Float64(sin(re) * Float64(im * im)))); elseif (im <= 2.5e+77) tmp = Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(re * 0.5)); else tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.058) tmp = sin(re) + (0.5 * (sin(re) * (im * im))); elseif (im <= 2.5e+77) tmp = (exp(-im) + exp(im)) * (re * 0.5); else tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.058], N[(N[Sin[re], $MachinePrecision] + N[(0.5 * N[(N[Sin[re], $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.5e+77], N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.058:\\
\;\;\;\;\sin re + 0.5 \cdot \left(\sin re \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;im \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;\left(e^{-im} + e^{im}\right) \cdot \left(re \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 0.0580000000000000029Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.8%
unpow284.8%
Simplified84.8%
if 0.0580000000000000029 < im < 2.50000000000000002e77Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 65.0%
associate-*r*65.0%
Simplified65.0%
if 2.50000000000000002e77 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-rgt-identity100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
metadata-eval100.0%
pow-sqr100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
unpow2100.0%
unpow2100.0%
Simplified100.0%
Final simplification86.4%
(FPCore (re im)
:precision binary64
(if (or (<= im 480.0) (not (<= im 5e+76)))
(*
(sin re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
(* (* im im) (+ (* re 0.5) (* (pow re 3.0) -0.08333333333333333)))))
double code(double re, double im) {
double tmp;
if ((im <= 480.0) || !(im <= 5e+76)) {
tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else {
tmp = (im * im) * ((re * 0.5) + (pow(re, 3.0) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= 480.0d0) .or. (.not. (im <= 5d+76))) then
tmp = sin(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
else
tmp = (im * im) * ((re * 0.5d0) + ((re ** 3.0d0) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 480.0) || !(im <= 5e+76)) {
tmp = Math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else {
tmp = (im * im) * ((re * 0.5) + (Math.pow(re, 3.0) * -0.08333333333333333));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 480.0) or not (im <= 5e+76): tmp = math.sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) else: tmp = (im * im) * ((re * 0.5) + (math.pow(re, 3.0) * -0.08333333333333333)) return tmp
function code(re, im) tmp = 0.0 if ((im <= 480.0) || !(im <= 5e+76)) tmp = Float64(sin(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); else tmp = Float64(Float64(im * im) * Float64(Float64(re * 0.5) + Float64((re ^ 3.0) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 480.0) || ~((im <= 5e+76))) tmp = sin(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); else tmp = (im * im) * ((re * 0.5) + ((re ^ 3.0) * -0.08333333333333333)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 480.0], N[Not[LessEqual[im, 5e+76]], $MachinePrecision]], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(N[(re * 0.5), $MachinePrecision] + N[(N[Power[re, 3.0], $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 480 \lor \neg \left(im \leq 5 \cdot 10^{+76}\right):\\
\;\;\;\;\sin re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if im < 480 or 4.99999999999999991e76 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 92.0%
*-rgt-identity92.0%
*-commutative92.0%
associate-*r*92.0%
*-commutative92.0%
associate-*r*92.0%
distribute-rgt-out92.0%
distribute-lft-out92.0%
metadata-eval92.0%
pow-sqr92.0%
associate-*r*92.0%
distribute-rgt-out92.0%
unpow292.0%
unpow292.0%
Simplified92.0%
if 480 < im < 4.99999999999999991e76Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.6%
*-rgt-identity4.6%
*-commutative4.6%
associate-*r*4.6%
*-commutative4.6%
associate-*r*4.6%
distribute-rgt-out4.6%
distribute-lft-out4.6%
metadata-eval4.6%
pow-sqr4.6%
associate-*r*4.6%
distribute-rgt-out4.6%
unpow24.6%
unpow24.6%
Simplified4.6%
Taylor expanded in im around 0 3.4%
*-commutative3.4%
unpow23.4%
Simplified3.4%
Taylor expanded in im around inf 3.4%
*-commutative3.4%
unpow23.4%
associate-*r*3.4%
associate-*l*3.4%
*-commutative3.4%
Simplified3.4%
Taylor expanded in re around 0 24.1%
+-commutative24.1%
associate-*r*24.1%
associate-*r*24.1%
distribute-rgt-out29.6%
unpow229.6%
*-commutative29.6%
*-commutative29.6%
Simplified29.6%
Final simplification87.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin re) (+ 1.0 (* im (* 0.5 im))))))
(if (<= im 400.0)
t_0
(if (<= im 3.3e+78)
(* (* im im) (+ (* re 0.5) (* (pow re 3.0) -0.08333333333333333)))
(if (<= im 1.85e+154)
(*
re
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
t_0)))))
double code(double re, double im) {
double t_0 = sin(re) * (1.0 + (im * (0.5 * im)));
double tmp;
if (im <= 400.0) {
tmp = t_0;
} else if (im <= 3.3e+78) {
tmp = (im * im) * ((re * 0.5) + (pow(re, 3.0) * -0.08333333333333333));
} else if (im <= 1.85e+154) {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} 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 = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
if (im <= 400.0d0) then
tmp = t_0
else if (im <= 3.3d+78) then
tmp = (im * im) * ((re * 0.5d0) + ((re ** 3.0d0) * (-0.08333333333333333d0)))
else if (im <= 1.85d+154) then
tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.sin(re) * (1.0 + (im * (0.5 * im)));
double tmp;
if (im <= 400.0) {
tmp = t_0;
} else if (im <= 3.3e+78) {
tmp = (im * im) * ((re * 0.5) + (Math.pow(re, 3.0) * -0.08333333333333333));
} else if (im <= 1.85e+154) {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.sin(re) * (1.0 + (im * (0.5 * im))) tmp = 0 if im <= 400.0: tmp = t_0 elif im <= 3.3e+78: tmp = (im * im) * ((re * 0.5) + (math.pow(re, 3.0) * -0.08333333333333333)) elif im <= 1.85e+154: tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im)))) tmp = 0.0 if (im <= 400.0) tmp = t_0; elseif (im <= 3.3e+78) tmp = Float64(Float64(im * im) * Float64(Float64(re * 0.5) + Float64((re ^ 3.0) * -0.08333333333333333))); elseif (im <= 1.85e+154) tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = sin(re) * (1.0 + (im * (0.5 * im))); tmp = 0.0; if (im <= 400.0) tmp = t_0; elseif (im <= 3.3e+78) tmp = (im * im) * ((re * 0.5) + ((re ^ 3.0) * -0.08333333333333333)); elseif (im <= 1.85e+154) tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 400.0], t$95$0, If[LessEqual[im, 3.3e+78], N[(N[(im * im), $MachinePrecision] * N[(N[(re * 0.5), $MachinePrecision] + N[(N[Power[re, 3.0], $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.85e+154], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{if}\;im \leq 400:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+78}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5 + {re}^{3} \cdot -0.08333333333333333\right)\\
\mathbf{elif}\;im \leq 1.85 \cdot 10^{+154}:\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < 400 or 1.84999999999999997e154 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 86.7%
*-commutative86.7%
associate-*r*86.7%
distribute-rgt1-in86.7%
*-commutative86.7%
unpow286.7%
associate-*l*86.7%
Simplified86.7%
if 400 < im < 3.3e78Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 9.4%
*-rgt-identity9.4%
*-commutative9.4%
associate-*r*9.4%
*-commutative9.4%
associate-*r*9.4%
distribute-rgt-out9.4%
distribute-lft-out9.4%
metadata-eval9.4%
pow-sqr9.4%
associate-*r*9.4%
distribute-rgt-out9.4%
unpow29.4%
unpow29.4%
Simplified9.4%
Taylor expanded in im around 0 3.4%
*-commutative3.4%
unpow23.4%
Simplified3.4%
Taylor expanded in im around inf 3.4%
*-commutative3.4%
unpow23.4%
associate-*r*3.4%
associate-*l*3.4%
*-commutative3.4%
Simplified3.4%
Taylor expanded in re around 0 26.8%
+-commutative26.8%
associate-*r*26.8%
associate-*r*26.8%
distribute-rgt-out31.8%
unpow231.8%
*-commutative31.8%
*-commutative31.8%
Simplified31.8%
if 3.3e78 < im < 1.84999999999999997e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-rgt-identity100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
metadata-eval100.0%
pow-sqr100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
unpow2100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
*-commutative80.0%
unpow280.0%
unpow280.0%
Simplified80.0%
Final simplification81.9%
(FPCore (re im) :precision binary64 (if (or (<= im 7e+24) (not (<= im 1.85e+154))) (* (sin re) (+ 1.0 (* im (* 0.5 im)))) (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
double code(double re, double im) {
double tmp;
if ((im <= 7e+24) || !(im <= 1.85e+154)) {
tmp = sin(re) * (1.0 + (im * (0.5 * im)));
} else {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= 7d+24) .or. (.not. (im <= 1.85d+154))) then
tmp = sin(re) * (1.0d0 + (im * (0.5d0 * im)))
else
tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= 7e+24) || !(im <= 1.85e+154)) {
tmp = Math.sin(re) * (1.0 + (im * (0.5 * im)));
} else {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= 7e+24) or not (im <= 1.85e+154): tmp = math.sin(re) * (1.0 + (im * (0.5 * im))) else: tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if ((im <= 7e+24) || !(im <= 1.85e+154)) tmp = Float64(sin(re) * Float64(1.0 + Float64(im * Float64(0.5 * im)))); else tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= 7e+24) || ~((im <= 1.85e+154))) tmp = sin(re) * (1.0 + (im * (0.5 * im))); else tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, 7e+24], N[Not[LessEqual[im, 1.85e+154]], $MachinePrecision]], N[(N[Sin[re], $MachinePrecision] * N[(1.0 + N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 7 \cdot 10^{+24} \lor \neg \left(im \leq 1.85 \cdot 10^{+154}\right):\\
\;\;\;\;\sin re \cdot \left(1 + im \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 7.0000000000000004e24 or 1.84999999999999997e154 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.2%
*-commutative85.2%
associate-*r*85.2%
distribute-rgt1-in85.2%
*-commutative85.2%
unpow285.2%
associate-*l*85.2%
Simplified85.2%
if 7.0000000000000004e24 < im < 1.84999999999999997e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 60.4%
*-rgt-identity60.4%
*-commutative60.4%
associate-*r*60.4%
*-commutative60.4%
associate-*r*60.4%
distribute-rgt-out60.4%
distribute-lft-out60.4%
metadata-eval60.4%
pow-sqr60.4%
associate-*r*60.4%
distribute-rgt-out60.4%
unpow260.4%
unpow260.4%
Simplified60.4%
Taylor expanded in re around 0 51.1%
*-commutative51.1%
unpow251.1%
unpow251.1%
Simplified51.1%
Final simplification80.4%
(FPCore (re im)
:precision binary64
(if (<= im 6e+24)
(sin re)
(if (<= im 2.8e+182)
(* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
(* 0.5 (* im (* (sin re) im))))))
double code(double re, double im) {
double tmp;
if (im <= 6e+24) {
tmp = sin(re);
} else if (im <= 2.8e+182) {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else {
tmp = 0.5 * (im * (sin(re) * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 6d+24) then
tmp = sin(re)
else if (im <= 2.8d+182) then
tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
else
tmp = 0.5d0 * (im * (sin(re) * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 6e+24) {
tmp = Math.sin(re);
} else if (im <= 2.8e+182) {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
} else {
tmp = 0.5 * (im * (Math.sin(re) * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 6e+24: tmp = math.sin(re) elif im <= 2.8e+182: tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) else: tmp = 0.5 * (im * (math.sin(re) * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 6e+24) tmp = sin(re); elseif (im <= 2.8e+182) tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); else tmp = Float64(0.5 * Float64(im * Float64(sin(re) * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 6e+24) tmp = sin(re); elseif (im <= 2.8e+182) tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); else tmp = 0.5 * (im * (sin(re) * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 6e+24], N[Sin[re], $MachinePrecision], If[LessEqual[im, 2.8e+182], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(im * N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 6 \cdot 10^{+24}:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 2.8 \cdot 10^{+182}:\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(\sin re \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 5.9999999999999999e24Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 66.6%
if 5.9999999999999999e24 < im < 2.80000000000000006e182Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 66.9%
*-rgt-identity66.9%
*-commutative66.9%
associate-*r*66.9%
*-commutative66.9%
associate-*r*66.9%
distribute-rgt-out66.9%
distribute-lft-out66.9%
metadata-eval66.9%
pow-sqr66.9%
associate-*r*66.9%
distribute-rgt-out66.9%
unpow266.9%
unpow266.9%
Simplified66.9%
Taylor expanded in re around 0 56.7%
*-commutative56.7%
unpow256.7%
unpow256.7%
Simplified56.7%
if 2.80000000000000006e182 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt1-in100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*84.9%
Simplified84.9%
Final simplification66.7%
(FPCore (re im) :precision binary64 (if (<= im 7e+24) (sin re) (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
double code(double re, double im) {
double tmp;
if (im <= 7e+24) {
tmp = sin(re);
} else {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 7d+24) then
tmp = sin(re)
else
tmp = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 7e+24) {
tmp = Math.sin(re);
} else {
tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 7e+24: tmp = math.sin(re) else: tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 7e+24) tmp = sin(re); else tmp = Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 7e+24) tmp = sin(re); else tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 7e+24], N[Sin[re], $MachinePrecision], N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 7 \cdot 10^{+24}:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 7.0000000000000004e24Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 66.6%
if 7.0000000000000004e24 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.0%
*-rgt-identity79.0%
*-commutative79.0%
associate-*r*79.0%
*-commutative79.0%
associate-*r*79.0%
distribute-rgt-out79.0%
distribute-lft-out79.0%
metadata-eval79.0%
pow-sqr79.0%
associate-*r*79.0%
distribute-rgt-out79.0%
unpow279.0%
unpow279.0%
Simplified79.0%
Taylor expanded in re around 0 62.3%
*-commutative62.3%
unpow262.3%
unpow262.3%
Simplified62.3%
Final simplification65.5%
(FPCore (re im) :precision binary64 (* re (+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))))
double code(double re, double im) {
return re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end function
public static double code(double re, double im) {
return re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
def code(re, im): return re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))))
function code(re, im) return Float64(re * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) end
function tmp = code(re, im) tmp = re * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end
code[re_, im_] := N[(re * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Taylor expanded in re around 0 53.0%
*-commutative53.0%
unpow253.0%
unpow253.0%
Simplified53.0%
Final simplification53.0%
(FPCore (re im)
:precision binary64
(if (<= im 1.5e-15)
re
(if (<= im 1.52e+100)
(+ 0.08333333333333333 (/ 0.25 (* re re)))
(* (* im im) (* re 0.5)))))
double code(double re, double im) {
double tmp;
if (im <= 1.5e-15) {
tmp = re;
} else if (im <= 1.52e+100) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else {
tmp = (im * im) * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.5d-15) then
tmp = re
else if (im <= 1.52d+100) then
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
else
tmp = (im * im) * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.5e-15) {
tmp = re;
} else if (im <= 1.52e+100) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else {
tmp = (im * im) * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.5e-15: tmp = re elif im <= 1.52e+100: tmp = 0.08333333333333333 + (0.25 / (re * re)) else: tmp = (im * im) * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.5e-15) tmp = re; elseif (im <= 1.52e+100) tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); else tmp = Float64(Float64(im * im) * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.5e-15) tmp = re; elseif (im <= 1.52e+100) tmp = 0.08333333333333333 + (0.25 / (re * re)); else tmp = (im * im) * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.5e-15], re, If[LessEqual[im, 1.52e+100], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.5 \cdot 10^{-15}:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 1.52 \cdot 10^{+100}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if im < 1.5e-15Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 58.2%
associate-*r*58.2%
Simplified58.2%
Taylor expanded in im around 0 35.0%
if 1.5e-15 < im < 1.52e100Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
sub0-neg99.9%
Simplified99.9%
Applied egg-rr13.8%
Taylor expanded in re around 0 13.4%
associate-*r/13.4%
metadata-eval13.4%
unpow213.4%
Simplified13.4%
if 1.52e100 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-rgt-identity100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
metadata-eval100.0%
pow-sqr100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
unpow2100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 69.9%
*-commutative69.9%
unpow269.9%
Simplified69.9%
Taylor expanded in im around inf 69.9%
*-commutative69.9%
unpow269.9%
associate-*r*51.7%
associate-*l*51.7%
*-commutative51.7%
Simplified51.7%
Taylor expanded in re around 0 56.1%
*-commutative56.1%
*-commutative56.1%
associate-*l*56.1%
unpow256.1%
Simplified56.1%
Final simplification36.4%
(FPCore (re im) :precision binary64 (if (<= im 1.5e-15) re (* (* im im) (* re 0.5))))
double code(double re, double im) {
double tmp;
if (im <= 1.5e-15) {
tmp = re;
} else {
tmp = (im * im) * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.5d-15) then
tmp = re
else
tmp = (im * im) * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.5e-15) {
tmp = re;
} else {
tmp = (im * im) * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.5e-15: tmp = re else: tmp = (im * im) * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.5e-15) tmp = re; else tmp = Float64(Float64(im * im) * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.5e-15) tmp = re; else tmp = (im * im) * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.5e-15], re, N[(N[(im * im), $MachinePrecision] * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.5 \cdot 10^{-15}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if im < 1.5e-15Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 58.2%
associate-*r*58.2%
Simplified58.2%
Taylor expanded in im around 0 35.0%
if 1.5e-15 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 75.0%
*-rgt-identity75.0%
*-commutative75.0%
associate-*r*75.0%
*-commutative75.0%
associate-*r*75.0%
distribute-rgt-out75.0%
distribute-lft-out74.9%
metadata-eval74.9%
pow-sqr74.9%
associate-*r*74.9%
distribute-rgt-out74.9%
unpow274.9%
unpow274.9%
Simplified74.9%
Taylor expanded in im around 0 48.4%
*-commutative48.4%
unpow248.4%
Simplified48.4%
Taylor expanded in im around inf 44.9%
*-commutative44.9%
unpow244.9%
associate-*r*33.6%
associate-*l*33.6%
*-commutative33.6%
Simplified33.6%
Taylor expanded in re around 0 38.3%
*-commutative38.3%
*-commutative38.3%
associate-*l*38.3%
unpow238.3%
Simplified38.3%
Final simplification36.0%
(FPCore (re im) :precision binary64 (* re (+ 1.0 (* 0.5 (* im im)))))
double code(double re, double im) {
return re * (1.0 + (0.5 * (im * im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * (1.0d0 + (0.5d0 * (im * im)))
end function
public static double code(double re, double im) {
return re * (1.0 + (0.5 * (im * im)));
}
def code(re, im): return re * (1.0 + (0.5 * (im * im)))
function code(re, im) return Float64(re * Float64(1.0 + Float64(0.5 * Float64(im * im)))) end
function tmp = code(re, im) tmp = re * (1.0 + (0.5 * (im * im))); end
code[re_, im_] := N[(re * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 73.8%
*-commutative73.8%
associate-*r*73.8%
distribute-rgt1-in73.8%
*-commutative73.8%
unpow273.8%
associate-*l*73.8%
Simplified73.8%
Taylor expanded in re around 0 45.5%
*-commutative45.5%
unpow245.5%
Simplified45.5%
Final simplification45.5%
(FPCore (re im) :precision binary64 (if (<= im 850.0) re (/ 0.25 (* re re))))
double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = re;
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 850.0d0) then
tmp = re
else
tmp = 0.25d0 / (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = re;
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 850.0: tmp = re else: tmp = 0.25 / (re * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 850.0) tmp = re; else tmp = Float64(0.25 / Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 850.0) tmp = re; else tmp = 0.25 / (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 850.0], re, N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 850:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if im < 850Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 57.5%
associate-*r*57.5%
Simplified57.5%
Taylor expanded in im around 0 34.3%
if 850 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr12.7%
Taylor expanded in re around 0 12.6%
unpow212.6%
Simplified12.6%
Final simplification28.2%
(FPCore (re im) :precision binary64 (if (<= im 850.0) re (/ (/ 0.25 re) re)))
double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = re;
} else {
tmp = (0.25 / re) / re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 850.0d0) then
tmp = re
else
tmp = (0.25d0 / re) / re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 850.0) {
tmp = re;
} else {
tmp = (0.25 / re) / re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 850.0: tmp = re else: tmp = (0.25 / re) / re return tmp
function code(re, im) tmp = 0.0 if (im <= 850.0) tmp = re; else tmp = Float64(Float64(0.25 / re) / re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 850.0) tmp = re; else tmp = (0.25 / re) / re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 850.0], re, N[(N[(0.25 / re), $MachinePrecision] / re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 850:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.25}{re}}{re}\\
\end{array}
\end{array}
if im < 850Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 57.5%
associate-*r*57.5%
Simplified57.5%
Taylor expanded in im around 0 34.3%
if 850 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Applied egg-rr12.7%
Taylor expanded in re around 0 12.6%
unpow212.6%
Simplified12.6%
add-sqr-sqrt12.6%
sqrt-div12.6%
metadata-eval12.6%
sqrt-prod12.1%
add-sqr-sqrt28.4%
sqrt-div28.4%
metadata-eval28.4%
sqrt-prod12.1%
add-sqr-sqrt12.6%
Applied egg-rr12.6%
Taylor expanded in re around 0 12.6%
unpow212.6%
associate-/r*12.6%
Simplified12.6%
Final simplification28.2%
(FPCore (re im) :precision binary64 -512.0)
double code(double re, double im) {
return -512.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -512.0d0
end function
public static double code(double re, double im) {
return -512.0;
}
def code(re, im): return -512.0
function code(re, im) return -512.0 end
function tmp = code(re, im) tmp = -512.0; end
code[re_, im_] := -512.0
\begin{array}{l}
\\
-512
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr3.5%
Final simplification3.5%
(FPCore (re im) :precision binary64 -1.0)
double code(double re, double im) {
return -1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.0d0
end function
public static double code(double re, double im) {
return -1.0;
}
def code(re, im): return -1.0
function code(re, im) return -1.0 end
function tmp = code(re, im) tmp = -1.0; end
code[re_, im_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr4.3%
Final simplification4.3%
(FPCore (re im) :precision binary64 0.015625)
double code(double re, double im) {
return 0.015625;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.015625d0
end function
public static double code(double re, double im) {
return 0.015625;
}
def code(re, im): return 0.015625
function code(re, im) return 0.015625 end
function tmp = code(re, im) tmp = 0.015625; end
code[re_, im_] := 0.015625
\begin{array}{l}
\\
0.015625
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr4.3%
Final simplification4.3%
(FPCore (re im) :precision binary64 0.0625)
double code(double re, double im) {
return 0.0625;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0625d0
end function
public static double code(double re, double im) {
return 0.0625;
}
def code(re, im): return 0.0625
function code(re, im) return 0.0625 end
function tmp = code(re, im) tmp = 0.0625; end
code[re_, im_] := 0.0625
\begin{array}{l}
\\
0.0625
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr4.5%
Final simplification4.5%
(FPCore (re im) :precision binary64 0.25)
double code(double re, double im) {
return 0.25;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.25d0
end function
public static double code(double re, double im) {
return 0.25;
}
def code(re, im): return 0.25
function code(re, im) return 0.25 end
function tmp = code(re, im) tmp = 0.25; end
code[re_, im_] := 0.25
\begin{array}{l}
\\
0.25
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr4.7%
Final simplification4.7%
(FPCore (re im) :precision binary64 0.5)
double code(double re, double im) {
return 0.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0
end function
public static double code(double re, double im) {
return 0.5;
}
def code(re, im): return 0.5
function code(re, im) return 0.5 end
function tmp = code(re, im) tmp = 0.5; end
code[re_, im_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr5.2%
Final simplification5.2%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
distribute-lft-out85.8%
metadata-eval85.8%
pow-sqr85.8%
associate-*r*85.8%
distribute-rgt-out85.8%
unpow285.8%
unpow285.8%
Simplified85.8%
Applied egg-rr5.2%
Final simplification5.2%
(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%
*-commutative100.0%
associate-*l*100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 61.6%
associate-*r*61.6%
Simplified61.6%
Taylor expanded in im around 0 25.4%
Final simplification25.4%
herbie shell --seed 2023242
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))