
(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 16 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 (fmod (exp x) (sqrt (cos x)))) (t_1 (* t_0 (exp (- x)))))
(if (<= t_1 0.0)
(fmod (exp x) (sqrt (+ (log (cbrt E)) (log (pow (cbrt E) 2.0)))))
(if (<= t_1 2.0) (+ (exp (log1p (/ t_0 (exp x)))) -1.0) (fmod 1.0 1.0)))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double t_1 = t_0 * exp(-x);
double tmp;
if (t_1 <= 0.0) {
tmp = fmod(exp(x), sqrt((log(cbrt(((double) M_E))) + log(pow(cbrt(((double) M_E)), 2.0)))));
} else if (t_1 <= 2.0) {
tmp = exp(log1p((t_0 / exp(x)))) + -1.0;
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = rem(exp(x), sqrt(cos(x))) t_1 = Float64(t_0 * exp(Float64(-x))) tmp = 0.0 if (t_1 <= 0.0) tmp = rem(exp(x), sqrt(Float64(log(cbrt(exp(1))) + log((cbrt(exp(1)) ^ 2.0))))); elseif (t_1 <= 2.0) tmp = Float64(exp(log1p(Float64(t_0 / exp(x)))) + -1.0); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[N[Power[E, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(N[Exp[N[Log[1 + N[(t$95$0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $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)\\
t_1 := t\_0 \cdot e^{-x}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;e^{\mathsf{log1p}\left(\frac{t\_0}{e^{x}}\right)} + -1\\
\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.3%
/-rgt-identity4.3%
associate-/r/4.3%
exp-neg4.3%
remove-double-neg4.3%
Simplified4.3%
add-log-exp4.3%
add-cube-cbrt52.0%
log-prod52.0%
pow252.0%
Applied egg-rr52.0%
Taylor expanded in x around 0 52.0%
exp-1-e52.0%
Simplified52.0%
Taylor expanded in x around 0 52.0%
exp-1-e52.0%
Simplified52.0%
Taylor expanded in x around 0 52.0%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) < 2Initial program 89.4%
/-rgt-identity89.4%
associate-/r/89.2%
exp-neg89.5%
remove-double-neg89.5%
Simplified89.5%
add-log-exp88.8%
Applied egg-rr88.8%
expm1-log1p-u89.1%
expm1-undefine90.0%
rem-log-exp90.5%
Applied egg-rr90.5%
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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
Final simplification62.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (exp (cos x)))))
(if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
(/ (fmod (exp x) (sqrt (+ (log (pow t_0 2.0)) (log t_0)))) (exp x))
(fmod 1.0 1.0))))
double code(double x) {
double t_0 = cbrt(exp(cos(x)));
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
tmp = fmod(exp(x), sqrt((log(pow(t_0, 2.0)) + log(t_0)))) / exp(x);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = cbrt(exp(cos(x))) tmp = 0.0 if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0) tmp = Float64(rem(exp(x), sqrt(Float64(log((t_0 ^ 2.0)) + log(t_0)))) / exp(x)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[Exp[N[Cos[x], $MachinePrecision]], $MachinePrecision], 1/3], $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] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[t$95$0, 2.0], $MachinePrecision]], $MachinePrecision] + N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[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}
t_0 := \sqrt[3]{e^{\cos x}}\\
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({t\_0}^{2}\right) + \log t\_0}\right)\right)}{e^{x}}\\
\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
add-log-exp8.5%
add-cube-cbrt53.8%
log-prod53.8%
pow253.8%
Applied egg-rr53.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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (exp (cos x)))))
(if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
(/
(fmod (exp x) (sqrt (+ (log (pow t_0 2.0)) (log t_0))))
(+ 1.0 (* x (+ 1.0 (* x 0.5)))))
(fmod 1.0 1.0))))
double code(double x) {
double t_0 = cbrt(exp(cos(x)));
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
tmp = fmod(exp(x), sqrt((log(pow(t_0, 2.0)) + log(t_0)))) / (1.0 + (x * (1.0 + (x * 0.5))));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
function code(x) t_0 = cbrt(exp(cos(x))) tmp = 0.0 if (Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) <= 2.0) tmp = Float64(rem(exp(x), sqrt(Float64(log((t_0 ^ 2.0)) + log(t_0)))) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5))))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[Exp[N[Cos[x], $MachinePrecision]], $MachinePrecision], 1/3], $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] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[t$95$0, 2.0], $MachinePrecision]], $MachinePrecision] + N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := \sqrt[3]{e^{\cos x}}\\
\mathbf{if}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({t\_0}^{2}\right) + \log t\_0}\right)\right)}{1 + x \cdot \left(1 + x \cdot 0.5\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
add-log-exp8.5%
add-cube-cbrt53.8%
log-prod53.8%
pow253.8%
Applied egg-rr53.8%
Taylor expanded in x around 0 53.2%
*-commutative53.2%
Simplified53.2%
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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
(FPCore (x)
:precision binary64
(if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
(/
(fmod
(exp x)
(sqrt (+ (log (pow (cbrt (exp (cos x))) 2.0)) (log (cbrt E)))))
(exp x))
(fmod 1.0 1.0)))
double code(double x) {
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
tmp = fmod(exp(x), sqrt((log(pow(cbrt(exp(cos(x))), 2.0)) + log(cbrt(((double) M_E)))))) / exp(x);
} 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(exp(x), sqrt(Float64(log((cbrt(exp(cos(x))) ^ 2.0)) + log(cbrt(exp(1)))))) / exp(x)); 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[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[N[Power[N[Exp[N[Cos[x], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[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}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left({\left(\sqrt[3]{e^{\cos x}}\right)}^{2}\right) + \log \left(\sqrt[3]{e}\right)}\right)\right)}{e^{x}}\\
\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
add-log-exp8.5%
add-cube-cbrt53.8%
log-prod53.8%
pow253.8%
Applied egg-rr53.8%
Taylor expanded in x around 0 53.0%
exp-1-e53.0%
Simplified53.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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
(FPCore (x)
:precision binary64
(if (<= (* (fmod (exp x) (sqrt (cos x))) (exp (- x))) 2.0)
(/
(fmod (exp x) (sqrt (+ (log (cbrt E)) (log (pow (cbrt E) 2.0)))))
(exp x))
(fmod 1.0 1.0)))
double code(double x) {
double tmp;
if ((fmod(exp(x), sqrt(cos(x))) * exp(-x)) <= 2.0) {
tmp = fmod(exp(x), sqrt((log(cbrt(((double) M_E))) + log(pow(cbrt(((double) M_E)), 2.0))))) / exp(x);
} 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(exp(x), sqrt(Float64(log(cbrt(exp(1))) + log((cbrt(exp(1)) ^ 2.0))))) / exp(x)); 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[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[(N[Log[N[Power[E, 1/3], $MachinePrecision]], $MachinePrecision] + N[Log[N[Power[N[Power[E, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[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}\;\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\log \left(\sqrt[3]{e}\right) + \log \left({\left(\sqrt[3]{e}\right)}^{2}\right)}\right)\right)}{e^{x}}\\
\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
add-log-exp8.5%
add-cube-cbrt53.8%
log-prod53.8%
pow253.8%
Applied egg-rr53.8%
Taylor expanded in x around 0 53.0%
exp-1-e53.0%
Simplified53.0%
Taylor expanded in x around 0 52.9%
exp-1-e53.0%
Simplified52.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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
Final simplification62.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (fmod (exp x) (sqrt (cos x)))))
(if (<= (* t_0 (exp (- x))) 2.0)
(+ (exp (log1p (/ t_0 (exp x)))) -1.0)
(fmod 1.0 1.0))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double tmp;
if ((t_0 * exp(-x)) <= 2.0) {
tmp = exp(log1p((t_0 / exp(x)))) + -1.0;
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
def code(x): t_0 = math.fmod(math.exp(x), math.sqrt(math.cos(x))) tmp = 0 if (t_0 * math.exp(-x)) <= 2.0: tmp = math.exp(math.log1p((t_0 / math.exp(x)))) + -1.0 else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) t_0 = rem(exp(x), sqrt(cos(x))) tmp = 0.0 if (Float64(t_0 * exp(Float64(-x))) <= 2.0) tmp = Float64(exp(log1p(Float64(t_0 / exp(x)))) + -1.0); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[Exp[N[Log[1 + N[(t$95$0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $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)\\
\mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\
\;\;\;\;e^{\mathsf{log1p}\left(\frac{t\_0}{e^{x}}\right)} + -1\\
\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
add-log-exp8.5%
Applied egg-rr8.5%
expm1-log1p-u8.5%
expm1-undefine8.5%
rem-log-exp8.6%
Applied egg-rr8.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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
Final simplification26.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (cos x))))
(if (<= (* (fmod (exp x) t_0) (exp (- x))) 2.0)
(/ (fmod (exp x) (expm1 (log1p t_0))) (exp x))
(fmod 1.0 1.0))))
double code(double x) {
double t_0 = sqrt(cos(x));
double tmp;
if ((fmod(exp(x), t_0) * exp(-x)) <= 2.0) {
tmp = fmod(exp(x), expm1(log1p(t_0))) / exp(x);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
def code(x): t_0 = math.sqrt(math.cos(x)) tmp = 0 if (math.fmod(math.exp(x), t_0) * math.exp(-x)) <= 2.0: tmp = math.fmod(math.exp(x), math.expm1(math.log1p(t_0))) / math.exp(x) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) t_0 = sqrt(cos(x)) tmp = 0.0 if (Float64(rem(exp(x), t_0) * exp(Float64(-x))) <= 2.0) tmp = Float64(rem(exp(x), expm1(log1p(t_0))) / exp(x)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[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}
t_0 := \sqrt{\cos x}\\
\mathbf{if}\;\left(\left(e^{x}\right) \bmod t\_0\right) \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t\_0\right)\right)\right)\right)}{e^{x}}\\
\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
expm1-log1p-u8.5%
expm1-undefine8.5%
Applied egg-rr8.5%
expm1-define8.5%
Simplified8.5%
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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
(FPCore (x) :precision binary64 (let* ((t_0 (fmod (exp x) (sqrt (cos x))))) (if (<= (* t_0 (exp (- x))) 2.0) (/ 1.0 (/ (exp x) t_0)) (fmod 1.0 1.0))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double tmp;
if ((t_0 * exp(-x)) <= 2.0) {
tmp = 1.0 / (exp(x) / t_0);
} 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 = mod(exp(x), sqrt(cos(x)))
if ((t_0 * exp(-x)) <= 2.0d0) then
tmp = 1.0d0 / (exp(x) / t_0)
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = math.fmod(math.exp(x), math.sqrt(math.cos(x))) tmp = 0 if (t_0 * math.exp(-x)) <= 2.0: tmp = 1.0 / (math.exp(x) / t_0) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) t_0 = rem(exp(x), sqrt(cos(x))) tmp = 0.0 if (Float64(t_0 * exp(Float64(-x))) <= 2.0) tmp = Float64(1.0 / Float64(exp(x) / t_0)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(1.0 / N[(N[Exp[x], $MachinePrecision] / t$95$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)\\
\mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{1}{\frac{e^{x}}{t\_0}}\\
\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 8.5%
exp-neg8.5%
div-inv8.5%
clear-num8.5%
Applied egg-rr8.5%
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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
(FPCore (x) :precision binary64 (let* ((t_0 (fmod (exp x) (sqrt (cos x))))) (if (<= (* t_0 (exp (- x))) 2.0) (/ t_0 (exp x)) (fmod 1.0 1.0))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double tmp;
if ((t_0 * exp(-x)) <= 2.0) {
tmp = t_0 / exp(x);
} 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 = mod(exp(x), sqrt(cos(x)))
if ((t_0 * exp(-x)) <= 2.0d0) then
tmp = t_0 / exp(x)
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = math.fmod(math.exp(x), math.sqrt(math.cos(x))) tmp = 0 if (t_0 * math.exp(-x)) <= 2.0: tmp = t_0 / math.exp(x) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) t_0 = rem(exp(x), sqrt(cos(x))) tmp = 0.0 if (Float64(t_0 * exp(Float64(-x))) <= 2.0) tmp = Float64(t_0 / exp(x)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 2.0], N[(t$95$0 / N[Exp[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}
t_0 := \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)\\
\mathbf{if}\;t\_0 \cdot e^{-x} \leq 2:\\
\;\;\;\;\frac{t\_0}{e^{x}}\\
\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 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
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 0.1%
Taylor expanded in x around 0 3.4%
Taylor expanded in x around 0 5.0%
Taylor expanded in x around 0 98.1%
(FPCore (x) :precision binary64 (if (<= x 500.0) (/ (fmod (exp x) (+ 1.0 (* -0.25 (* x x)))) (exp x)) (fmod 1.0 1.0)))
double code(double x) {
double tmp;
if (x <= 500.0) {
tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / exp(x);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 500.0d0) then
tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / exp(x)
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 500.0: tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / math.exp(x) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= 500.0) tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / exp(x)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[x, 500.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[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 500:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 500Initial program 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
Taylor expanded in x around 0 8.3%
unpow28.3%
Applied egg-rr8.3%
if 500 < x Initial program 0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* x (+ 1.0 (* x 0.5))))))
(if (<= x 200.0)
(/ (fmod t_0 (+ 1.0 (* -0.25 (pow x 2.0)))) t_0)
(fmod 1.0 1.0))))
double code(double x) {
double t_0 = 1.0 + (x * (1.0 + (x * 0.5)));
double tmp;
if (x <= 200.0) {
tmp = fmod(t_0, (1.0 + (-0.25 * pow(x, 2.0)))) / t_0;
} 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 = 1.0d0 + (x * (1.0d0 + (x * 0.5d0)))
if (x <= 200.0d0) then
tmp = mod(t_0, (1.0d0 + ((-0.25d0) * (x ** 2.0d0)))) / t_0
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = 1.0 + (x * (1.0 + (x * 0.5))) tmp = 0 if x <= 200.0: tmp = math.fmod(t_0, (1.0 + (-0.25 * math.pow(x, 2.0)))) / t_0 else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) t_0 = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))) tmp = 0.0 if (x <= 200.0) tmp = Float64(rem(t_0, Float64(1.0 + Float64(-0.25 * (x ^ 2.0)))) / t_0); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 200.0], N[(N[With[{TMP1 = t$95$0, TMP2 = N[(1.0 + N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / t$95$0), $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 := 1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\mathbf{if}\;x \leq 200:\\
\;\;\;\;\frac{\left(t\_0 \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 200Initial program 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
Taylor expanded in x around 0 8.3%
Taylor expanded in x around 0 7.9%
*-commutative53.0%
Simplified7.9%
Taylor expanded in x around 0 8.1%
*-commutative53.0%
Simplified8.1%
if 200 < x Initial program 0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 100.0%
(FPCore (x)
:precision binary64
(if (<= x 200.0)
(/
(fmod (exp x) (+ 1.0 (* -0.25 (* x x))))
(+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))
(fmod 1.0 1.0)))
double code(double x) {
double tmp;
if (x <= 200.0) {
tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 200.0d0) then
tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))))
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 200.0: tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= 200.0) tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[x, 200.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 200:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 200Initial program 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
Taylor expanded in x around 0 8.3%
unpow28.3%
Applied egg-rr8.3%
Taylor expanded in x around 0 8.0%
*-commutative8.0%
Simplified8.0%
if 200 < x Initial program 0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 100.0%
(FPCore (x) :precision binary64 (if (<= x 200.0) (/ (fmod (exp x) (+ 1.0 (* -0.25 (* x x)))) (+ 1.0 (* x (+ 1.0 (* x 0.5))))) (fmod 1.0 1.0)))
double code(double x) {
double tmp;
if (x <= 200.0) {
tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / (1.0 + (x * (1.0 + (x * 0.5))));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 200.0d0) then
tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / (1.0d0 + (x * (1.0d0 + (x * 0.5d0))))
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 200.0: tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / (1.0 + (x * (1.0 + (x * 0.5)))) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= 200.0) tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5))))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[x, 200.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 200:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{1 + x \cdot \left(1 + x \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 200Initial program 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
Taylor expanded in x around 0 8.3%
Taylor expanded in x around 0 7.9%
*-commutative53.0%
Simplified7.9%
unpow28.3%
Applied egg-rr7.9%
if 200 < x Initial program 0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 100.0%
(FPCore (x) :precision binary64 (if (<= x 200.0) (/ (fmod (exp x) (+ 1.0 (* -0.25 (* x x)))) (+ x 1.0)) (fmod 1.0 1.0)))
double code(double x) {
double tmp;
if (x <= 200.0) {
tmp = fmod(exp(x), (1.0 + (-0.25 * (x * x)))) / (x + 1.0);
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 200.0d0) then
tmp = mod(exp(x), (1.0d0 + ((-0.25d0) * (x * x)))) / (x + 1.0d0)
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 200.0: tmp = math.fmod(math.exp(x), (1.0 + (-0.25 * (x * x)))) / (x + 1.0) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= 200.0) tmp = Float64(rem(exp(x), Float64(1.0 + Float64(-0.25 * Float64(x * x)))) / Float64(x + 1.0)); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[x, 200.0], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(-0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(x + 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}\;x \leq 200:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot \left(x \cdot x\right)\right)\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 200Initial program 8.5%
/-rgt-identity8.5%
associate-/r/8.5%
exp-neg8.5%
remove-double-neg8.5%
Simplified8.5%
Taylor expanded in x around 0 8.3%
unpow28.3%
Applied egg-rr8.3%
Taylor expanded in x around 0 7.4%
+-commutative7.4%
Simplified7.4%
if 200 < x Initial program 0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 100.0%
(FPCore (x) :precision binary64 (if (<= x 200.0) (fmod 1.0 (- 1.0 (* -0.25 (pow x 2.0)))) (fmod 1.0 1.0)))
double code(double x) {
double tmp;
if (x <= 200.0) {
tmp = fmod(1.0, (1.0 - (-0.25 * pow(x, 2.0))));
} else {
tmp = fmod(1.0, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 200.0d0) then
tmp = mod(1.0d0, (1.0d0 - ((-0.25d0) * (x ** 2.0d0))))
else
tmp = mod(1.0d0, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= 200.0: tmp = math.fmod(1.0, (1.0 - (-0.25 * math.pow(x, 2.0)))) else: tmp = math.fmod(1.0, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= 200.0) tmp = rem(1.0, Float64(1.0 - Float64(-0.25 * (x ^ 2.0)))); else tmp = rem(1.0, 1.0); end return tmp end
code[x_] := If[LessEqual[x, 200.0], N[With[{TMP1 = 1.0, TMP2 = N[(1.0 - N[(-0.25 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $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 200:\\
\;\;\;\;\left(1 \bmod \left(1 - -0.25 \cdot {x}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 \bmod 1\right)\\
\end{array}
\end{array}
if x < 200Initial program 8.5%
Taylor expanded in x around 0 6.4%
Taylor expanded in x around 0 4.7%
Taylor expanded in x around 0 5.1%
unpow25.1%
sqr-neg5.1%
neg-mul-15.1%
associate-*l*5.1%
pow15.1%
metadata-eval5.1%
add-sqr-sqrt2.2%
sqrt-unprod5.1%
sqr-neg5.1%
unpow25.1%
sqrt-pow16.4%
sqr-pow6.4%
Applied egg-rr6.4%
neg-mul-16.4%
Simplified6.4%
if 200 < x Initial program 0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 100.0%
Final simplification25.1%
(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 6.8%
Taylor expanded in x around 0 5.1%
Taylor expanded in x around 0 4.4%
Taylor expanded in x around 0 4.7%
Taylor expanded in x around 0 23.4%
herbie shell --seed 2024172
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))