
(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 14 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}
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (fma (* 0.5 (sin re)) (exp (- im_m)) (* (* (exp im_m) 0.5) (sin re))))
im_m = fabs(im);
double code(double re, double im_m) {
return fma((0.5 * sin(re)), exp(-im_m), ((exp(im_m) * 0.5) * sin(re)));
}
im_m = abs(im) function code(re, im_m) return fma(Float64(0.5 * sin(re)), exp(Float64(-im_m)), Float64(Float64(exp(im_m) * 0.5) * sin(re))) end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[Exp[(-im$95$m)], $MachinePrecision] + N[(N[(N[Exp[im$95$m], $MachinePrecision] * 0.5), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\mathsf{fma}\left(0.5 \cdot \sin re, e^{-im\_m}, \left(e^{im\_m} \cdot 0.5\right) \cdot \sin re\right)
\end{array}
Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub0-negN/A
lower-neg.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification100.0%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))) (t_1 (* (+ (exp (- im_m)) (exp im_m)) t_0)))
(if (<= t_1 (- INFINITY))
(*
(*
(fma
(fma (* -9.92063492063492e-5 (* re re)) (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_1 3.0)
(* (fma im_m im_m 2.0) t_0)
(*
(fma (pow im_m 4.0) 0.08333333333333333 (fma im_m im_m 2.0))
(* 0.5 re))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = 0.5 * sin(re);
double t_1 = (exp(-im_m) + exp(im_m)) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fma(fma((-9.92063492063492e-5 * (re * re)), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_1 <= 3.0) {
tmp = fma(im_m, im_m, 2.0) * t_0;
} else {
tmp = fma(pow(im_m, 4.0), 0.08333333333333333, fma(im_m, im_m, 2.0)) * (0.5 * re);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(0.5 * sin(re)) t_1 = Float64(Float64(exp(Float64(-im_m)) + exp(im_m)) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(Float64(-9.92063492063492e-5 * Float64(re * re)), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_1 <= 3.0) tmp = Float64(fma(im_m, im_m, 2.0) * t_0); else tmp = Float64(fma((im_m ^ 4.0), 0.08333333333333333, fma(im_m, im_m, 2.0)) * Float64(0.5 * re)); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 3.0], N[(N[(im$95$m * im$95$m + 2.0), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Power[im$95$m, 4.0], $MachinePrecision] * 0.08333333333333333 + N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := \left(e^{-im\_m} + e^{im\_m}\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5} \cdot \left(re \cdot re\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_1 \leq 3:\\
\;\;\;\;\mathsf{fma}\left(im\_m, im\_m, 2\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({im\_m}^{4}, 0.08333333333333333, \mathsf{fma}\left(im\_m, im\_m, 2\right)\right) \cdot \left(0.5 \cdot re\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.6
Applied rewrites47.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6452.7
Applied rewrites52.7%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6452.8
Applied rewrites52.8%
Taylor expanded in re around inf
Applied rewrites52.8%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 3Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6498.7
Applied rewrites98.7%
if 3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.8
Applied rewrites47.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6443.2
Applied rewrites43.2%
Taylor expanded in re around 0
lower-*.f6448.4
Applied rewrites48.4%
Taylor expanded in im around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
pow-sqrN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
lower-pow.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6462.1
Applied rewrites62.1%
Final simplification77.7%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* 0.5 (sin re))) (t_1 (* (+ (exp (- im_m)) (exp im_m)) t_0)))
(if (<= t_1 (- INFINITY))
(*
(*
(fma
(fma (* -9.92063492063492e-5 (* re re)) (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_1 5.0)
(* (fma im_m im_m 2.0) t_0)
(*
(*
(fma
(fma 0.004166666666666667 (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = 0.5 * sin(re);
double t_1 = (exp(-im_m) + exp(im_m)) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (fma(fma((-9.92063492063492e-5 * (re * re)), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_1 <= 5.0) {
tmp = fma(im_m, im_m, 2.0) * t_0;
} else {
tmp = (fma(fma(0.004166666666666667, (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(0.5 * sin(re)) t_1 = Float64(Float64(exp(Float64(-im_m)) + exp(im_m)) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(Float64(-9.92063492063492e-5 * Float64(re * re)), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_1 <= 5.0) tmp = Float64(fma(im_m, im_m, 2.0) * t_0); else tmp = Float64(Float64(fma(fma(0.004166666666666667, Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5.0], N[(N[(im$95$m * im$95$m + 2.0), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
t_1 := \left(e^{-im\_m} + e^{im\_m}\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5} \cdot \left(re \cdot re\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_1 \leq 5:\\
\;\;\;\;\mathsf{fma}\left(im\_m, im\_m, 2\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.004166666666666667, re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.6
Applied rewrites47.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6452.7
Applied rewrites52.7%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6452.8
Applied rewrites52.8%
Taylor expanded in re around inf
Applied rewrites52.8%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 5Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6498.7
Applied rewrites98.7%
if 5 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.8
Applied rewrites47.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6443.2
Applied rewrites43.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6454.2
Applied rewrites54.2%
Final simplification75.7%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* (+ (exp (- im_m)) (exp im_m)) (* 0.5 (sin re)))))
(if (<= t_0 (- INFINITY))
(*
(*
(fma
(fma (* -9.92063492063492e-5 (* re re)) (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))
(if (<= t_0 3.0)
(sin re)
(*
(*
(fma
(fma 0.004166666666666667 (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = (exp(-im_m) + exp(im_m)) * (0.5 * sin(re));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (fma(fma((-9.92063492063492e-5 * (re * re)), (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
} else if (t_0 <= 3.0) {
tmp = sin(re);
} else {
tmp = (fma(fma(0.004166666666666667, (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(Float64(exp(Float64(-im_m)) + exp(im_m)) * Float64(0.5 * sin(re))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(fma(fma(Float64(-9.92063492063492e-5 * Float64(re * re)), Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); elseif (t_0 <= 3.0) tmp = sin(re); else tmp = Float64(Float64(fma(fma(0.004166666666666667, Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(-9.92063492063492e-5 * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 3.0], N[Sin[re], $MachinePrecision], N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \left(e^{-im\_m} + e^{im\_m}\right) \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5} \cdot \left(re \cdot re\right), re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{elif}\;t\_0 \leq 3:\\
\;\;\;\;\sin re\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.004166666666666667, re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.6
Applied rewrites47.6%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6452.7
Applied rewrites52.7%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6452.8
Applied rewrites52.8%
Taylor expanded in re around inf
Applied rewrites52.8%
if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 3Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub0-negN/A
lower-neg.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
distribute-lft-inN/A
distribute-rgt-outN/A
metadata-evalN/A
associate-*r*N/A
mul0-rgtN/A
+-rgt-identityN/A
lower-sin.f6498.6
Applied rewrites98.6%
if 3 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6447.8
Applied rewrites47.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6443.2
Applied rewrites43.2%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6454.2
Applied rewrites54.2%
Final simplification75.7%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (if (<= (* (+ (exp (- im_m)) (exp im_m)) (* 0.5 (sin re))) 5e-6) (* 2.0 (* (fma (* re re) (* -0.16666666666666666 re) re) 0.5)) (* (* 0.5 re) (fma im_m im_m 2.0))))
im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (((exp(-im_m) + exp(im_m)) * (0.5 * sin(re))) <= 5e-6) {
tmp = 2.0 * (fma((re * re), (-0.16666666666666666 * re), re) * 0.5);
} else {
tmp = (0.5 * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (Float64(Float64(exp(Float64(-im_m)) + exp(im_m)) * Float64(0.5 * sin(re))) <= 5e-6) tmp = Float64(2.0 * Float64(fma(Float64(re * re), Float64(-0.16666666666666666 * re), re) * 0.5)); else tmp = Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[(N[(N[Exp[(-im$95$m)], $MachinePrecision] + N[Exp[im$95$m], $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-6], N[(2.0 * N[(N[(N[(re * re), $MachinePrecision] * N[(-0.16666666666666666 * re), $MachinePrecision] + re), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(e^{-im\_m} + e^{im\_m}\right) \cdot \left(0.5 \cdot \sin re\right) \leq 5 \cdot 10^{-6}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666 \cdot re, re\right) \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < 5.00000000000000041e-6Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6476.9
Applied rewrites76.9%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6459.0
Applied rewrites59.0%
Applied rewrites59.0%
Taylor expanded in im around 0
Applied rewrites43.3%
if 5.00000000000000041e-6 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6466.3
Applied rewrites66.3%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6428.8
Applied rewrites28.8%
Taylor expanded in re around 0
lower-*.f6432.3
Applied rewrites32.3%
Final simplification39.1%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (* (cosh im_m) (sin re)))
im_m = fabs(im);
double code(double re, double im_m) {
return cosh(im_m) * sin(re);
}
im_m = abs(im)
real(8) function code(re, im_m)
real(8), intent (in) :: re
real(8), intent (in) :: im_m
code = cosh(im_m) * sin(re)
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
return Math.cosh(im_m) * Math.sin(re);
}
im_m = math.fabs(im) def code(re, im_m): return math.cosh(im_m) * math.sin(re)
im_m = abs(im) function code(re, im_m) return Float64(cosh(im_m) * sin(re)) end
im_m = abs(im); function tmp = code(re, im_m) tmp = cosh(im_m) * sin(re); end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[Cosh[im$95$m], $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\cosh im\_m \cdot \sin re
\end{array}
Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-*.f64N/A
*-lft-identity100.0
Applied rewrites100.0%
Final simplification100.0%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= re 0.028)
(* (* 2.0 (* (fma -0.08333333333333333 (* re re) 0.5) re)) (cosh im_m))
(*
(fma
(*
(fma
(fma (* im_m im_m) 0.001388888888888889 0.041666666666666664)
(* im_m im_m)
0.5)
im_m)
im_m
1.0)
(sin re))))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (re <= 0.028) {
tmp = (2.0 * (fma(-0.08333333333333333, (re * re), 0.5) * re)) * cosh(im_m);
} else {
tmp = fma((fma(fma((im_m * im_m), 0.001388888888888889, 0.041666666666666664), (im_m * im_m), 0.5) * im_m), im_m, 1.0) * sin(re);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (re <= 0.028) tmp = Float64(Float64(2.0 * Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re)) * cosh(im_m)); else tmp = Float64(fma(Float64(fma(fma(Float64(im_m * im_m), 0.001388888888888889, 0.041666666666666664), Float64(im_m * im_m), 0.5) * im_m), im_m, 1.0) * sin(re)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[re, 0.028], N[(N[(2.0 * N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[Cosh[im$95$m], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 0.5), $MachinePrecision] * im$95$m), $MachinePrecision] * im$95$m + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;re \leq 0.028:\\
\;\;\;\;\left(2 \cdot \left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)\right) \cdot \cosh im\_m\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(im\_m \cdot im\_m, 0.001388888888888889, 0.041666666666666664\right), im\_m \cdot im\_m, 0.5\right) \cdot im\_m, im\_m, 1\right) \cdot \sin re\\
\end{array}
\end{array}
if re < 0.0280000000000000006Initial program 100.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.5
Applied rewrites75.5%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
neg-sub0N/A
cosh-undefN/A
lift-cosh.f64N/A
*-lft-identityN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites75.5%
if 0.0280000000000000006 < re Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-*.f64N/A
*-lft-identity100.0
Applied rewrites100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.6
Applied rewrites92.6%
Applied rewrites92.6%
Final simplification79.7%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= re 0.028)
(* (* 2.0 (* (fma -0.08333333333333333 (* re re) 0.5) re)) (cosh im_m))
(*
(fma
(fma
(fma 0.001388888888888889 (* im_m im_m) 0.041666666666666664)
(* im_m im_m)
0.5)
(* im_m im_m)
1.0)
(sin re))))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (re <= 0.028) {
tmp = (2.0 * (fma(-0.08333333333333333, (re * re), 0.5) * re)) * cosh(im_m);
} else {
tmp = fma(fma(fma(0.001388888888888889, (im_m * im_m), 0.041666666666666664), (im_m * im_m), 0.5), (im_m * im_m), 1.0) * sin(re);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (re <= 0.028) tmp = Float64(Float64(2.0 * Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re)) * cosh(im_m)); else tmp = Float64(fma(fma(fma(0.001388888888888889, Float64(im_m * im_m), 0.041666666666666664), Float64(im_m * im_m), 0.5), Float64(im_m * im_m), 1.0) * sin(re)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[re, 0.028], N[(N[(2.0 * N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[Cosh[im$95$m], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.001388888888888889 * N[(im$95$m * im$95$m), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im$95$m * im$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;re \leq 0.028:\\
\;\;\;\;\left(2 \cdot \left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)\right) \cdot \cosh im\_m\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889, im\_m \cdot im\_m, 0.041666666666666664\right), im\_m \cdot im\_m, 0.5\right), im\_m \cdot im\_m, 1\right) \cdot \sin re\\
\end{array}
\end{array}
if re < 0.0280000000000000006Initial program 100.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.5
Applied rewrites75.5%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
neg-sub0N/A
cosh-undefN/A
lift-cosh.f64N/A
*-lft-identityN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites75.5%
if 0.0280000000000000006 < re Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.6
Applied rewrites92.6%
Final simplification79.7%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(if (<= (sin re) -0.01)
(* (* (fma (* re re) -0.08333333333333333 0.5) re) (fma im_m im_m 2.0))
(*
(*
(fma
(fma 0.004166666666666667 (* re re) -0.08333333333333333)
(* re re)
0.5)
re)
(fma im_m im_m 2.0))))im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= -0.01) {
tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (fma(fma(0.004166666666666667, (re * re), -0.08333333333333333), (re * re), 0.5) * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= -0.01) tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(fma(fma(0.004166666666666667, Float64(re * re), -0.08333333333333333), Float64(re * re), 0.5) * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], -0.01], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision] + -0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq -0.01:\\
\;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.004166666666666667, re \cdot re, -0.08333333333333333\right), re \cdot re, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (sin.f64 re) < -0.0100000000000000002Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6472.8
Applied rewrites72.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6425.0
Applied rewrites25.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6425.0
Applied rewrites25.0%
if -0.0100000000000000002 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6472.8
Applied rewrites72.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6454.0
Applied rewrites54.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.5
Applied rewrites57.5%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0
(*
(fma (* (fma (* im_m im_m) 0.041666666666666664 0.5) im_m) im_m 1.0)
(sin re))))
(if (<= im_m 1.75)
t_0
(if (<= im_m 2.5e+77)
(* (* 2.0 (* (fma -0.08333333333333333 (* re re) 0.5) re)) (cosh im_m))
t_0))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = fma((fma((im_m * im_m), 0.041666666666666664, 0.5) * im_m), im_m, 1.0) * sin(re);
double tmp;
if (im_m <= 1.75) {
tmp = t_0;
} else if (im_m <= 2.5e+77) {
tmp = (2.0 * (fma(-0.08333333333333333, (re * re), 0.5) * re)) * cosh(im_m);
} else {
tmp = t_0;
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(fma(Float64(fma(Float64(im_m * im_m), 0.041666666666666664, 0.5) * im_m), im_m, 1.0) * sin(re)) tmp = 0.0 if (im_m <= 1.75) tmp = t_0; elseif (im_m <= 2.5e+77) tmp = Float64(Float64(2.0 * Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re)) * cosh(im_m)); else tmp = t_0; end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision] * im$95$m), $MachinePrecision] * im$95$m + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 1.75], t$95$0, If[LessEqual[im$95$m, 2.5e+77], N[(N[(2.0 * N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[Cosh[im$95$m], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(im\_m \cdot im\_m, 0.041666666666666664, 0.5\right) \cdot im\_m, im\_m, 1\right) \cdot \sin re\\
\mathbf{if}\;im\_m \leq 1.75:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im\_m \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;\left(2 \cdot \left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)\right) \cdot \cosh im\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 1.75 or 2.50000000000000002e77 < im Initial program 100.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
sub0-negN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
exp-0N/A
lower-*.f64N/A
exp-0N/A
lower-cosh.f64100.0
Applied rewrites100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.5
Applied rewrites92.5%
Applied rewrites92.5%
if 1.75 < im < 2.50000000000000002e77Initial program 100.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6473.7
Applied rewrites73.7%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
neg-sub0N/A
cosh-undefN/A
lift-cosh.f64N/A
*-lft-identityN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites73.7%
Final simplification91.1%
im_m = (fabs.f64 im)
(FPCore (re im_m)
:precision binary64
(let* ((t_0 (* (fma im_m im_m 2.0) (* 0.5 (sin re)))))
(if (<= im_m 1.75)
t_0
(if (<= im_m 1.32e+154)
(* (* 2.0 (* (fma -0.08333333333333333 (* re re) 0.5) re)) (cosh im_m))
t_0))))im_m = fabs(im);
double code(double re, double im_m) {
double t_0 = fma(im_m, im_m, 2.0) * (0.5 * sin(re));
double tmp;
if (im_m <= 1.75) {
tmp = t_0;
} else if (im_m <= 1.32e+154) {
tmp = (2.0 * (fma(-0.08333333333333333, (re * re), 0.5) * re)) * cosh(im_m);
} else {
tmp = t_0;
}
return tmp;
}
im_m = abs(im) function code(re, im_m) t_0 = Float64(fma(im_m, im_m, 2.0) * Float64(0.5 * sin(re))) tmp = 0.0 if (im_m <= 1.75) tmp = t_0; elseif (im_m <= 1.32e+154) tmp = Float64(Float64(2.0 * Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re)) * cosh(im_m)); else tmp = t_0; end return tmp end
im_m = N[Abs[im], $MachinePrecision]
code[re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m + 2.0), $MachinePrecision] * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im$95$m, 1.75], t$95$0, If[LessEqual[im$95$m, 1.32e+154], N[(N[(2.0 * N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[Cosh[im$95$m], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im\_m, im\_m, 2\right) \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{if}\;im\_m \leq 1.75:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im\_m \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(2 \cdot \left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)\right) \cdot \cosh im\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 1.75 or 1.31999999999999998e154 < im Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6483.0
Applied rewrites83.0%
if 1.75 < im < 1.31999999999999998e154Initial program 100.0%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.8
Applied rewrites75.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-exp.f64N/A
lift-exp.f64N/A
lift--.f64N/A
neg-sub0N/A
cosh-undefN/A
lift-cosh.f64N/A
*-lft-identityN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites75.8%
Final simplification82.0%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (if (<= (sin re) 5e-6) (* (* (fma (* re re) -0.08333333333333333 0.5) re) (fma im_m im_m 2.0)) (* (* 0.5 re) (fma im_m im_m 2.0))))
im_m = fabs(im);
double code(double re, double im_m) {
double tmp;
if (sin(re) <= 5e-6) {
tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * fma(im_m, im_m, 2.0);
} else {
tmp = (0.5 * re) * fma(im_m, im_m, 2.0);
}
return tmp;
}
im_m = abs(im) function code(re, im_m) tmp = 0.0 if (sin(re) <= 5e-6) tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * fma(im_m, im_m, 2.0)); else tmp = Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)); end return tmp end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := If[LessEqual[N[Sin[re], $MachinePrecision], 5e-6], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
im_m = \left|im\right|
\\
\begin{array}{l}
\mathbf{if}\;\sin re \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)\\
\end{array}
\end{array}
if (sin.f64 re) < 5.00000000000000041e-6Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6472.1
Applied rewrites72.1%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6457.4
Applied rewrites57.4%
Taylor expanded in re around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.4
Applied rewrites57.4%
if 5.00000000000000041e-6 < (sin.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6475.0
Applied rewrites75.0%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6417.1
Applied rewrites17.1%
Taylor expanded in re around 0
lower-*.f6422.5
Applied rewrites22.5%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (* (* 0.5 re) (fma im_m im_m 2.0)))
im_m = fabs(im);
double code(double re, double im_m) {
return (0.5 * re) * fma(im_m, im_m, 2.0);
}
im_m = abs(im) function code(re, im_m) return Float64(Float64(0.5 * re) * fma(im_m, im_m, 2.0)) end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(N[(0.5 * re), $MachinePrecision] * N[(im$95$m * im$95$m + 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(im\_m, im\_m, 2\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6472.8
Applied rewrites72.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6447.3
Applied rewrites47.3%
Taylor expanded in re around 0
lower-*.f6445.2
Applied rewrites45.2%
im_m = (fabs.f64 im) (FPCore (re im_m) :precision binary64 (* 2.0 (* 0.5 re)))
im_m = fabs(im);
double code(double re, double im_m) {
return 2.0 * (0.5 * re);
}
im_m = abs(im)
real(8) function code(re, im_m)
real(8), intent (in) :: re
real(8), intent (in) :: im_m
code = 2.0d0 * (0.5d0 * re)
end function
im_m = Math.abs(im);
public static double code(double re, double im_m) {
return 2.0 * (0.5 * re);
}
im_m = math.fabs(im) def code(re, im_m): return 2.0 * (0.5 * re)
im_m = abs(im) function code(re, im_m) return Float64(2.0 * Float64(0.5 * re)) end
im_m = abs(im); function tmp = code(re, im_m) tmp = 2.0 * (0.5 * re); end
im_m = N[Abs[im], $MachinePrecision] code[re_, im$95$m_] := N[(2.0 * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
im_m = \left|im\right|
\\
2 \cdot \left(0.5 \cdot re\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
lower-fma.f6472.8
Applied rewrites72.8%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-pow.f6447.3
Applied rewrites47.3%
Taylor expanded in re around 0
lower-*.f6445.2
Applied rewrites45.2%
Taylor expanded in im around 0
Applied rewrites24.3%
Final simplification24.3%
herbie shell --seed 2024296
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))