
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
def code(x): return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
function code(x) return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
def code(x): return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
function code(x) return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))) (t_1 (* (fmod (exp x) (sqrt (cos x))) t_0)))
(if (<= t_1 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_1 2.0)
(*
t_0
(fmod
(exp x)
(fma
(* x x)
(fma
(* x x)
(fma x (* x -0.0026041666666666665) -0.010416666666666666)
-0.25)
1.0)))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = exp(-x);
double t_1 = fmod(exp(x), sqrt(cos(x))) * t_0;
double tmp;
if (t_1 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_1 <= 2.0) {
tmp = t_0 * fmod(exp(x), fma((x * x), fma((x * x), fma(x, (x * -0.0026041666666666665), -0.010416666666666666), -0.25), 1.0));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) t_1 = Float64(rem(exp(x), sqrt(cos(x))) * t_0) tmp = 0.0 if (t_1 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_1 <= 2.0) tmp = Float64(t_0 * rem(exp(x), fma(Float64(x * x), fma(Float64(x * x), fma(x, Float64(x * -0.0026041666666666665), -0.010416666666666666), -0.25), 1.0))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$1 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(t$95$0 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * -0.0026041666666666665), $MachinePrecision] + -0.010416666666666666), $MachinePrecision] + -0.25), $MachinePrecision] + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
t_1 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;t\_0 \cdot \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot -0.0026041666666666665, -0.010416666666666666\right), -0.25\right), 1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.9
Simplified84.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f6485.0
Simplified85.0%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification65.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))) (t_1 (* (fmod (exp x) (sqrt (cos x))) t_0)))
(if (<= t_1 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_1 2.0)
(*
t_0
(fmod
(exp x)
(sqrt (fma (* x x) (fma (* x x) 0.041666666666666664 -0.5) 1.0))))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = exp(-x);
double t_1 = fmod(exp(x), sqrt(cos(x))) * t_0;
double tmp;
if (t_1 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_1 <= 2.0) {
tmp = t_0 * fmod(exp(x), sqrt(fma((x * x), fma((x * x), 0.041666666666666664, -0.5), 1.0)));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) t_1 = Float64(rem(exp(x), sqrt(cos(x))) * t_0) tmp = 0.0 if (t_1 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_1 <= 2.0) tmp = Float64(t_0 * rem(exp(x), sqrt(fma(Float64(x * x), fma(Float64(x * x), 0.041666666666666664, -0.5), 1.0)))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$1 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(t$95$0 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.041666666666666664 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
t_1 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;t\_0 \cdot \left(\left(e^{x}\right) \bmod \left(\sqrt{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, -0.5\right), 1\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.9
Simplified84.9%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification65.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))) (t_1 (* (fmod (exp x) (sqrt (cos x))) t_0)))
(if (<= t_1 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_1 2.0)
(*
t_0
(fmod
(exp x)
(fma (* x x) (fma x (* x -0.010416666666666666) -0.25) 1.0)))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = exp(-x);
double t_1 = fmod(exp(x), sqrt(cos(x))) * t_0;
double tmp;
if (t_1 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_1 <= 2.0) {
tmp = t_0 * fmod(exp(x), fma((x * x), fma(x, (x * -0.010416666666666666), -0.25), 1.0));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) t_1 = Float64(rem(exp(x), sqrt(cos(x))) * t_0) tmp = 0.0 if (t_1 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_1 <= 2.0) tmp = Float64(t_0 * rem(exp(x), fma(Float64(x * x), fma(x, Float64(x * -0.010416666666666666), -0.25), 1.0))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$1 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(t$95$0 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * -0.010416666666666666), $MachinePrecision] + -0.25), $MachinePrecision] + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
t_1 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;t\_0 \cdot \left(\left(e^{x}\right) \bmod \left(\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot -0.010416666666666666, -0.25\right), 1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.9
Simplified84.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f6484.3
Simplified84.3%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification65.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))) (t_1 (* (fmod (exp x) (sqrt (cos x))) t_0)))
(if (<= t_1 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_1 2.0)
(* t_0 (fmod (exp x) (sqrt (fma x (* x -0.5) 1.0))))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = exp(-x);
double t_1 = fmod(exp(x), sqrt(cos(x))) * t_0;
double tmp;
if (t_1 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_1 <= 2.0) {
tmp = t_0 * fmod(exp(x), sqrt(fma(x, (x * -0.5), 1.0)));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = exp(Float64(-x)) t_1 = Float64(rem(exp(x), sqrt(cos(x))) * t_0) tmp = 0.0 if (t_1 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_1 <= 2.0) tmp = Float64(t_0 * rem(exp(x), sqrt(fma(x, Float64(x * -0.5), 1.0)))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$1 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(t$95$0 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
t_1 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;t\_0 \cdot \left(\left(e^{x}\right) \bmod \left(\sqrt{\mathsf{fma}\left(x, x \cdot -0.5, 1\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6480.6
Simplified80.6%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification65.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fmod (exp x) (sqrt (cos x))) (exp (- x)))))
(if (<= t_0 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_0 2.0)
(*
(fmod
(exp x)
(sqrt (fma (* x x) (fma (* x x) 0.041666666666666664 -0.5) 1.0)))
(fma x (fma x (fma x -0.16666666666666666 0.5) -1.0) 1.0))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x))) * exp(-x);
double tmp;
if (t_0 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_0 <= 2.0) {
tmp = fmod(exp(x), sqrt(fma((x * x), fma((x * x), 0.041666666666666664, -0.5), 1.0))) * fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) tmp = 0.0 if (t_0 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_0 <= 2.0) tmp = Float64(rem(exp(x), sqrt(fma(Float64(x * x), fma(Float64(x * x), 0.041666666666666664, -0.5), 1.0))) * fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.041666666666666664 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(x * N[(x * N[(x * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.041666666666666664, -0.5\right), 1\right)}\right)\right) \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.9
Simplified84.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6475.1
Simplified75.1%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification65.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fmod (exp x) (sqrt (cos x))) (exp (- x)))))
(if (<= t_0 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_0 2.0)
(*
(fmod (exp x) (sqrt (fma x (* x -0.5) 1.0)))
(fma x (fma x (fma x -0.16666666666666666 0.5) -1.0) 1.0))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x))) * exp(-x);
double tmp;
if (t_0 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_0 <= 2.0) {
tmp = fmod(exp(x), sqrt(fma(x, (x * -0.5), 1.0))) * fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) tmp = 0.0 if (t_0 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_0 <= 2.0) tmp = Float64(rem(exp(x), sqrt(fma(x, Float64(x * -0.5), 1.0))) * fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(x * N[(x * N[(x * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\mathsf{fma}\left(x, x \cdot -0.5, 1\right)}\right)\right) \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6480.6
Simplified80.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.7
Simplified73.7%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification65.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fmod (exp x) (sqrt (cos x))) (exp (- x)))))
(if (<= t_0 0.0)
(fmod
(exp x)
(/ -1.5 (* (sqrt 0.041666666666666664) (* x (* x (* x x))))))
(if (<= t_0 2.0)
(*
(fmod (fma x (fma x 0.5 1.0) 1.0) (sqrt (fma x (* x -0.5) 1.0)))
(fma x (fma x 0.5 -1.0) 1.0))
(fmod 1.0 1.0)))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x))) * exp(-x);
double tmp;
if (t_0 <= 0.0) {
tmp = fmod(exp(x), (-1.5 / (sqrt(0.041666666666666664) * (x * (x * (x * x))))));
} else if (t_0 <= 2.0) {
tmp = fmod(fma(x, fma(x, 0.5, 1.0), 1.0), sqrt(fma(x, (x * -0.5), 1.0))) * fma(x, fma(x, 0.5, -1.0), 1.0);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) tmp = 0.0 if (t_0 <= 0.0) tmp = rem(exp(x), Float64(-1.5 / Float64(sqrt(0.041666666666666664) * Float64(x * Float64(x * Float64(x * x)))))); elseif (t_0 <= 2.0) tmp = Float64(rem(fma(x, fma(x, 0.5, 1.0), 1.0), sqrt(fma(x, Float64(x * -0.5), 1.0))) * fma(x, fma(x, 0.5, -1.0), 1.0)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[Sqrt[0.041666666666666664], $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(N[With[{TMP1 = N[(x * N[(x * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], TMP2 = N[Sqrt[N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(x * N[(x * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\sqrt{0.041666666666666664} \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, 1\right), 1\right)\right) \bmod \left(\sqrt{\mathsf{fma}\left(x, x \cdot -0.5, 1\right)}\right)\right) \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 0.0Initial program 4.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f644.1
Simplified4.1%
Taylor expanded in x around inf
Simplified55.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.4
Simplified55.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 85.5%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6480.6
Simplified80.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6468.0
Simplified68.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6469.4
Simplified69.4%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification64.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= (* (fmod (exp x) (sqrt (cos x))) t_0) 2.0)
(*
t_0
(fmod
(exp x)
(/ -1.5 (* (* (* x x) (* x x)) (sqrt 0.041666666666666664)))))
(fmod 1.0 1.0))))
double code(double x) {
double t_0 = exp(-x);
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * t_0) <= 2.0) {
tmp = t_0 * fmod(exp(x), (-1.5 / (((x * x) * (x * x)) * sqrt(0.041666666666666664))));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if ((mod(exp(x), sqrt(cos(x))) * t_0) <= 2.0d0) then
tmp = t_0 * mod(exp(x), ((-1.5d0) / (((x * x) * (x * x)) * sqrt(0.041666666666666664d0))))
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = math.exp(-x) tmp = 0 if (math.fmod(math.exp(x), math.sqrt(math.cos(x))) * t_0) <= 2.0: tmp = t_0 * math.fmod(math.exp(x), (-1.5 / (((x * x) * (x * x)) * math.sqrt(0.041666666666666664)))) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) t_0 = exp(Float64(-x)) tmp = 0.0 if (Float64(rem(exp(x), sqrt(cos(x))) * t_0) <= 2.0) tmp = Float64(t_0 * rem(exp(x), Float64(-1.5 / Float64(Float64(Float64(x * x) * Float64(x * x)) * sqrt(0.041666666666666664))))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$0), $MachinePrecision], 2.0], N[(t$95$0 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(-1.5 / N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.041666666666666664], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot t\_0 \leq 2:\\
\;\;\;\;t\_0 \cdot \left(\left(e^{x}\right) \bmod \left(\frac{-1.5}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \sqrt{0.041666666666666664}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 10.2%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6410.1
Simplified10.1%
Taylor expanded in x around inf
Simplified55.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f6455.7
Simplified55.7%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification64.3%
(FPCore (x)
:precision binary64
(if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
(*
(fmod (fma x (fma x 0.5 1.0) 1.0) (sqrt (fma x (* x -0.5) 1.0)))
(fma x (fma x 0.5 -1.0) 1.0))
(fmod 1.0 1.0)))
double code(double x) {
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
tmp = fmod(fma(x, fma(x, 0.5, 1.0), 1.0), sqrt(fma(x, (x * -0.5), 1.0))) * fma(x, fma(x, 0.5, -1.0), 1.0);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0) tmp = Float64(rem(fma(x, fma(x, 0.5, 1.0), 1.0), sqrt(fma(x, Float64(x * -0.5), 1.0))) * fma(x, fma(x, 0.5, -1.0), 1.0)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[(x * N[(x * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], TMP2 = N[Sqrt[N[(x * N[(x * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(x * N[(x * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, 1\right), 1\right)\right) \bmod \left(\sqrt{\mathsf{fma}\left(x, x \cdot -0.5, 1\right)}\right)\right) \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 10.2%
Taylor expanded in x around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.8
Simplified9.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f648.9
Simplified8.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f649.0
Simplified9.0%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
(FPCore (x) :precision binary64 (if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0) (* (- 1.0 x) (fmod (+ x 1.0) (fma x (* x -0.25) 1.0))) (fmod 1.0 1.0)))
double code(double x) {
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
tmp = (1.0 - x) * fmod((x + 1.0), fma(x, (x * -0.25), 1.0));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0) tmp = Float64(Float64(1.0 - x) * rem(Float64(x + 1.0), fma(x, Float64(x * -0.25), 1.0))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[(1.0 - x), $MachinePrecision] * N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = N[(x * N[(x * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\left(1 - x\right) \cdot \left(\left(x + 1\right) \bmod \left(\mathsf{fma}\left(x, x \cdot -0.25, 1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 10.2%
Taylor expanded in x around 0
associate-*r*N/A
neg-mul-1N/A
distribute-lft1-inN/A
*-commutativeN/A
lower-*.f64N/A
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f64N/A
+-commutativeN/A
unsub-negN/A
lower--.f648.2
Simplified8.2%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f648.2
Simplified8.2%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f647.8
Simplified7.8%
if 2 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.1
Simplified0.1%
Taylor expanded in x around 0
Simplified0.1%
Taylor expanded in x around 0
Simplified96.4%
Final simplification26.5%
(FPCore (x) :precision binary64 (if (<= x 0.01) (* (fmod (fma x (fma x 0.5 1.0) 1.0) (fma x (* x -0.25) 1.0)) (- 1.0 x)) (fmod 1.0 1.0)))
double code(double x) {
double tmp;
if (x <= 0.01) {
tmp = fmod(fma(x, fma(x, 0.5, 1.0), 1.0), fma(x, (x * -0.25), 1.0)) * (1.0 - x);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.01) tmp = Float64(rem(fma(x, fma(x, 0.5, 1.0), 1.0), fma(x, Float64(x * -0.25), 1.0)) * Float64(1.0 - x)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[x, 0.01], N[(N[With[{TMP1 = N[(x * N[(x * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], TMP2 = N[(x * N[(x * -0.25), $MachinePrecision] + 1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.01:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, 1\right), 1\right)\right) \bmod \left(\mathsf{fma}\left(x, x \cdot -0.25, 1\right)\right)\right) \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 0.0100000000000000002Initial program 10.1%
Taylor expanded in x around 0
associate-*r*N/A
neg-mul-1N/A
distribute-lft1-inN/A
*-commutativeN/A
lower-*.f64N/A
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f64N/A
+-commutativeN/A
unsub-negN/A
lower--.f648.1
Simplified8.1%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f648.1
Simplified8.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f648.2
Simplified8.2%
if 0.0100000000000000002 < x Initial program 0.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f640.0
Simplified0.0%
Taylor expanded in x around 0
Simplified0.0%
Taylor expanded in x around 0
Simplified100.0%
(FPCore (x) :precision binary64 (fmod (+ x 1.0) 1.0))
double code(double x) {
return fmod((x + 1.0), 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod((x + 1.0d0), 1.0d0)
end function
def code(x): return math.fmod((x + 1.0), 1.0)
function code(x) return rem(Float64(x + 1.0), 1.0) end
code[x_] := N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + 1\right) \bmod 1\right)
\end{array}
Initial program 8.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f645.6
Simplified5.6%
Taylor expanded in x around 0
Simplified5.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f6424.8
Simplified24.8%
(FPCore (x) :precision binary64 (fmod 1.0 1.0))
double code(double x) {
return fmod(1.0, 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(1.0d0, 1.0d0)
end function
def code(x): return math.fmod(1.0, 1.0)
function code(x) return rem(1.0, 1.0) end
code[x_] := N[With[{TMP1 = 1.0, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}
\\
\left(1 \bmod 1\right)
\end{array}
Initial program 8.0%
Taylor expanded in x around 0
lower-fmod.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-cos.f645.6
Simplified5.6%
Taylor expanded in x around 0
Simplified5.6%
Taylor expanded in x around 0
Simplified23.5%
herbie shell --seed 2024215
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))