
(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 12 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
(if (<= x -1e-309)
(/
(fmod
(exp x)
(sqrt (+ (log (pow (cbrt (exp (cos x))) 2.0)) (log (cbrt E)))))
(exp x))
(/ (fmod x 1.0) (exp x))))
double code(double x) {
double tmp;
if (x <= -1e-309) {
tmp = fmod(exp(x), sqrt((log(pow(cbrt(exp(cos(x))), 2.0)) + log(cbrt(((double) M_E)))))) / exp(x);
} else {
tmp = fmod(x, 1.0) / exp(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -1e-309) tmp = Float64(rem(exp(x), sqrt(Float64(log((cbrt(exp(cos(x))) ^ 2.0)) + log(cbrt(exp(1)))))) / exp(x)); else tmp = Float64(rem(x, 1.0) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -1e-309], 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[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{e^{x}}\\
\end{array}
\end{array}
if x < -1.000000000000002e-309Initial program 8.3%
/-rgt-identity8.3%
associate-/r/8.3%
exp-neg8.3%
remove-double-neg8.3%
Simplified8.3%
add-log-exp8.3%
add-cube-cbrt100.0%
log-prod100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
exp-1-e100.0%
Simplified100.0%
if -1.000000000000002e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around 0 97.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (cos x))) (t_1 (cbrt (+ -1.0 (/ 1.0 x)))))
(if (<= x -7.5e-104)
(/
(fmod (* x (/ (/ (+ -1.0 (pow x -2.0)) t_1) (pow t_1 2.0))) t_0)
(exp x))
(if (<= x -5e-309)
(/ (fmod (* x (pow (cbrt (+ 1.0 (/ 1.0 x))) 3.0)) t_0) (exp x))
(/ (fmod x 1.0) (exp x))))))
double code(double x) {
double t_0 = sqrt(cos(x));
double t_1 = cbrt((-1.0 + (1.0 / x)));
double tmp;
if (x <= -7.5e-104) {
tmp = fmod((x * (((-1.0 + pow(x, -2.0)) / t_1) / pow(t_1, 2.0))), t_0) / exp(x);
} else if (x <= -5e-309) {
tmp = fmod((x * pow(cbrt((1.0 + (1.0 / x))), 3.0)), t_0) / exp(x);
} else {
tmp = fmod(x, 1.0) / exp(x);
}
return tmp;
}
function code(x) t_0 = sqrt(cos(x)) t_1 = cbrt(Float64(-1.0 + Float64(1.0 / x))) tmp = 0.0 if (x <= -7.5e-104) tmp = Float64(rem(Float64(x * Float64(Float64(Float64(-1.0 + (x ^ -2.0)) / t_1) / (t_1 ^ 2.0))), t_0) / exp(x)); elseif (x <= -5e-309) tmp = Float64(rem(Float64(x * (cbrt(Float64(1.0 + Float64(1.0 / x))) ^ 3.0)), t_0) / exp(x)); else tmp = Float64(rem(x, 1.0) / exp(x)); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[x, -7.5e-104], N[(N[With[{TMP1 = N[(x * N[(N[(N[(-1.0 + N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] / N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-309], N[(N[With[{TMP1 = N[(x * N[Power[N[Power[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\cos x}\\
t_1 := \sqrt[3]{-1 + \frac{1}{x}}\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-104}:\\
\;\;\;\;\frac{\left(\left(x \cdot \frac{\frac{-1 + {x}^{-2}}{t\_1}}{{t\_1}^{2}}\right) \bmod t\_0\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(\left(x \cdot {\left(\sqrt[3]{1 + \frac{1}{x}}\right)}^{3}\right) \bmod t\_0\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{e^{x}}\\
\end{array}
\end{array}
if x < -7.5e-104Initial program 23.3%
/-rgt-identity23.3%
associate-/r/23.3%
exp-neg23.3%
remove-double-neg23.3%
Simplified23.3%
Taylor expanded in x around 0 19.3%
+-commutative19.3%
Simplified19.3%
Taylor expanded in x around inf 27.3%
+-commutative27.3%
flip-+27.3%
inv-pow27.3%
inv-pow27.3%
pow-prod-up32.5%
metadata-eval32.5%
metadata-eval32.5%
Applied egg-rr32.5%
*-un-lft-identity32.5%
add-cube-cbrt71.1%
times-frac70.7%
pow270.7%
sub-neg70.7%
metadata-eval70.7%
sub-neg70.7%
metadata-eval70.7%
sub-neg70.7%
metadata-eval70.7%
Applied egg-rr70.7%
associate-*l/71.1%
*-lft-identity71.1%
+-commutative71.1%
+-commutative71.1%
+-commutative71.1%
Simplified71.1%
if -7.5e-104 < x < -4.9999999999999995e-309Initial program 3.1%
/-rgt-identity3.1%
associate-/r/3.1%
exp-neg3.1%
remove-double-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in x around inf 19.7%
add-cube-cbrt40.3%
pow341.7%
Applied egg-rr41.7%
if -4.9999999999999995e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around 0 97.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (cos x))))
(if (<= x -7.6e-141)
(/
(fmod
(/
(expm1 (log1p (+ x (pow x -2.0))))
(+ 1.0 (+ (pow x -2.0) (/ -1.0 x))))
t_0)
(exp x))
(if (<= x -5e-309)
(/ (fmod (* x (pow (cbrt (+ 1.0 (/ 1.0 x))) 3.0)) t_0) (exp x))
(/ (fmod x 1.0) (exp x))))))
double code(double x) {
double t_0 = sqrt(cos(x));
double tmp;
if (x <= -7.6e-141) {
tmp = fmod((expm1(log1p((x + pow(x, -2.0)))) / (1.0 + (pow(x, -2.0) + (-1.0 / x)))), t_0) / exp(x);
} else if (x <= -5e-309) {
tmp = fmod((x * pow(cbrt((1.0 + (1.0 / x))), 3.0)), t_0) / exp(x);
} else {
tmp = fmod(x, 1.0) / exp(x);
}
return tmp;
}
function code(x) t_0 = sqrt(cos(x)) tmp = 0.0 if (x <= -7.6e-141) tmp = Float64(rem(Float64(expm1(log1p(Float64(x + (x ^ -2.0)))) / Float64(1.0 + Float64((x ^ -2.0) + Float64(-1.0 / x)))), t_0) / exp(x)); elseif (x <= -5e-309) tmp = Float64(rem(Float64(x * (cbrt(Float64(1.0 + Float64(1.0 / x))) ^ 3.0)), t_0) / exp(x)); else tmp = Float64(rem(x, 1.0) / exp(x)); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -7.6e-141], N[(N[With[{TMP1 = N[(N[(Exp[N[Log[1 + N[(x + N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] / N[(1.0 + N[(N[Power[x, -2.0], $MachinePrecision] + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-309], N[(N[With[{TMP1 = N[(x * N[Power[N[Power[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\cos x}\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{-141}:\\
\;\;\;\;\frac{\left(\left(\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(x + {x}^{-2}\right)\right)}{1 + \left({x}^{-2} + \frac{-1}{x}\right)}\right) \bmod t\_0\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(\left(x \cdot {\left(\sqrt[3]{1 + \frac{1}{x}}\right)}^{3}\right) \bmod t\_0\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{e^{x}}\\
\end{array}
\end{array}
if x < -7.59999999999999973e-141Initial program 15.5%
/-rgt-identity15.5%
associate-/r/15.5%
exp-neg15.5%
remove-double-neg15.5%
Simplified15.5%
Taylor expanded in x around 0 13.1%
+-commutative13.1%
Simplified13.1%
Taylor expanded in x around inf 18.0%
*-commutative18.0%
flip3-+15.3%
associate-*l/17.3%
metadata-eval17.3%
inv-pow17.3%
pow-pow20.0%
metadata-eval20.0%
metadata-eval20.0%
inv-pow20.0%
inv-pow20.0%
pow-prod-up22.1%
metadata-eval22.1%
*-un-lft-identity22.1%
Applied egg-rr22.1%
expm1-log1p-u37.1%
expm1-undefine37.1%
*-commutative37.1%
Applied egg-rr37.1%
expm1-define37.1%
distribute-rgt-in37.1%
*-lft-identity37.1%
pow-plus59.2%
metadata-eval59.2%
Simplified59.2%
if -7.59999999999999973e-141 < x < -4.9999999999999995e-309Initial program 3.1%
/-rgt-identity3.1%
associate-/r/3.1%
exp-neg3.1%
remove-double-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in x around inf 24.3%
add-cube-cbrt38.0%
pow339.8%
Applied egg-rr39.8%
if -4.9999999999999995e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around 0 97.8%
Final simplification79.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (cos x))))
(if (<= x -2e-135)
(/ (fmod (* (- 1.0 (pow x -2.0)) (/ x (+ 1.0 (/ -1.0 x)))) t_0) (exp x))
(if (<= x -8.5e-296)
(/ (log (exp (fmod (* x (+ 1.0 (/ 1.0 x))) t_0))) (exp x))
(/ (fabs (fmod x 1.0)) (exp x))))))
double code(double x) {
double t_0 = sqrt(cos(x));
double tmp;
if (x <= -2e-135) {
tmp = fmod(((1.0 - pow(x, -2.0)) * (x / (1.0 + (-1.0 / x)))), t_0) / exp(x);
} else if (x <= -8.5e-296) {
tmp = log(exp(fmod((x * (1.0 + (1.0 / x))), t_0))) / exp(x);
} else {
tmp = fabs(fmod(x, 1.0)) / exp(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(cos(x))
if (x <= (-2d-135)) then
tmp = mod(((1.0d0 - (x ** (-2.0d0))) * (x / (1.0d0 + ((-1.0d0) / x)))), t_0) / exp(x)
else if (x <= (-8.5d-296)) then
tmp = log(exp(mod((x * (1.0d0 + (1.0d0 / x))), t_0))) / exp(x)
else
tmp = abs(mod(x, 1.0d0)) / exp(x)
end if
code = tmp
end function
def code(x): t_0 = math.sqrt(math.cos(x)) tmp = 0 if x <= -2e-135: tmp = math.fmod(((1.0 - math.pow(x, -2.0)) * (x / (1.0 + (-1.0 / x)))), t_0) / math.exp(x) elif x <= -8.5e-296: tmp = math.log(math.exp(math.fmod((x * (1.0 + (1.0 / x))), t_0))) / math.exp(x) else: tmp = math.fabs(math.fmod(x, 1.0)) / math.exp(x) return tmp
function code(x) t_0 = sqrt(cos(x)) tmp = 0.0 if (x <= -2e-135) tmp = Float64(rem(Float64(Float64(1.0 - (x ^ -2.0)) * Float64(x / Float64(1.0 + Float64(-1.0 / x)))), t_0) / exp(x)); elseif (x <= -8.5e-296) tmp = Float64(log(exp(rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), t_0))) / exp(x)); else tmp = Float64(abs(rem(x, 1.0)) / exp(x)); end return tmp end
code[x_] := Block[{t$95$0 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2e-135], N[(N[With[{TMP1 = N[(N[(1.0 - N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision] * N[(x / N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-296], N[(N[Log[N[Exp[N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = t$95$0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\cos x}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-135}:\\
\;\;\;\;\frac{\left(\left(\left(1 - {x}^{-2}\right) \cdot \frac{x}{1 + \frac{-1}{x}}\right) \bmod t\_0\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-296}:\\
\;\;\;\;\frac{\log \left(e^{\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod t\_0\right)}\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\left(x \bmod 1\right)\right|}{e^{x}}\\
\end{array}
\end{array}
if x < -2.0000000000000001e-135Initial program 15.9%
/-rgt-identity15.9%
associate-/r/15.9%
exp-neg15.9%
remove-double-neg15.9%
Simplified15.9%
Taylor expanded in x around 0 13.4%
+-commutative13.4%
Simplified13.4%
Taylor expanded in x around inf 18.4%
flip-+18.4%
associate-*r/18.8%
metadata-eval18.8%
inv-pow18.8%
inv-pow18.8%
pow-prod-up21.5%
metadata-eval21.5%
Applied egg-rr21.5%
*-commutative21.5%
associate-/l*39.1%
Simplified39.1%
if -2.0000000000000001e-135 < x < -8.50000000000000018e-296Initial program 3.1%
/-rgt-identity3.1%
associate-/r/3.1%
exp-neg3.1%
remove-double-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in x around inf 24.3%
+-commutative24.3%
flip-+0.1%
inv-pow0.1%
inv-pow0.1%
pow-prod-up1.9%
metadata-eval1.9%
metadata-eval1.9%
Applied egg-rr1.9%
add-log-exp1.9%
metadata-eval1.9%
pow-prod-up0.1%
inv-pow0.1%
inv-pow0.1%
metadata-eval0.1%
flip-+24.7%
Applied egg-rr24.7%
if -8.50000000000000018e-296 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.0%
+-commutative39.0%
Simplified39.0%
Taylor expanded in x around inf 97.2%
add-sqr-sqrt96.6%
sqrt-unprod65.5%
pow265.5%
Applied egg-rr65.5%
unpow265.5%
rem-sqrt-square97.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
Final simplification73.3%
(FPCore (x) :precision binary64 (if (<= x -5e-309) (/ (fmod (* x (pow (cbrt (+ 1.0 (/ 1.0 x))) 3.0)) (sqrt (cos x))) (exp x)) (/ (fmod x 1.0) (exp x))))
double code(double x) {
double tmp;
if (x <= -5e-309) {
tmp = fmod((x * pow(cbrt((1.0 + (1.0 / x))), 3.0)), sqrt(cos(x))) / exp(x);
} else {
tmp = fmod(x, 1.0) / exp(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -5e-309) tmp = Float64(rem(Float64(x * (cbrt(Float64(1.0 + Float64(1.0 / x))) ^ 3.0)), sqrt(cos(x))) / exp(x)); else tmp = Float64(rem(x, 1.0) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -5e-309], N[(N[With[{TMP1 = N[(x * N[Power[N[Power[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(\left(x \cdot {\left(\sqrt[3]{1 + \frac{1}{x}}\right)}^{3}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{e^{x}}\\
\end{array}
\end{array}
if x < -4.9999999999999995e-309Initial program 8.3%
/-rgt-identity8.3%
associate-/r/8.3%
exp-neg8.3%
remove-double-neg8.3%
Simplified8.3%
Taylor expanded in x around 0 7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 21.7%
add-cube-cbrt39.6%
pow340.7%
Applied egg-rr40.7%
if -4.9999999999999995e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around 0 97.8%
(FPCore (x)
:precision binary64
(if (<= x -1e-142)
(/
(fmod (* (- 1.0 (pow x -2.0)) (/ x (+ 1.0 (/ -1.0 x)))) (sqrt (cos x)))
(exp x))
(if (<= x -8.5e-296)
(fmod (* x (+ 1.0 (/ 1.0 x))) 1.0)
(/ (fabs (fmod x 1.0)) (exp x)))))
double code(double x) {
double tmp;
if (x <= -1e-142) {
tmp = fmod(((1.0 - pow(x, -2.0)) * (x / (1.0 + (-1.0 / x)))), sqrt(cos(x))) / exp(x);
} else if (x <= -8.5e-296) {
tmp = fmod((x * (1.0 + (1.0 / x))), 1.0);
} else {
tmp = fabs(fmod(x, 1.0)) / exp(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1d-142)) then
tmp = mod(((1.0d0 - (x ** (-2.0d0))) * (x / (1.0d0 + ((-1.0d0) / x)))), sqrt(cos(x))) / exp(x)
else if (x <= (-8.5d-296)) then
tmp = mod((x * (1.0d0 + (1.0d0 / x))), 1.0d0)
else
tmp = abs(mod(x, 1.0d0)) / exp(x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -1e-142: tmp = math.fmod(((1.0 - math.pow(x, -2.0)) * (x / (1.0 + (-1.0 / x)))), math.sqrt(math.cos(x))) / math.exp(x) elif x <= -8.5e-296: tmp = math.fmod((x * (1.0 + (1.0 / x))), 1.0) else: tmp = math.fabs(math.fmod(x, 1.0)) / math.exp(x) return tmp
function code(x) tmp = 0.0 if (x <= -1e-142) tmp = Float64(rem(Float64(Float64(1.0 - (x ^ -2.0)) * Float64(x / Float64(1.0 + Float64(-1.0 / x)))), sqrt(cos(x))) / exp(x)); elseif (x <= -8.5e-296) tmp = rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), 1.0); else tmp = Float64(abs(rem(x, 1.0)) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -1e-142], N[(N[With[{TMP1 = N[(N[(1.0 - N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision] * N[(x / N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = N[Sqrt[N[Cos[x], $MachinePrecision]], $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-296], N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[(N[Abs[N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-142}:\\
\;\;\;\;\frac{\left(\left(\left(1 - {x}^{-2}\right) \cdot \frac{x}{1 + \frac{-1}{x}}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-296}:\\
\;\;\;\;\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\left(x \bmod 1\right)\right|}{e^{x}}\\
\end{array}
\end{array}
if x < -1e-142Initial program 15.2%
/-rgt-identity15.2%
associate-/r/15.2%
exp-neg15.2%
remove-double-neg15.2%
Simplified15.2%
Taylor expanded in x around 0 12.8%
+-commutative12.8%
Simplified12.8%
Taylor expanded in x around inf 17.6%
flip-+17.6%
associate-*r/18.0%
metadata-eval18.0%
inv-pow18.0%
inv-pow18.0%
pow-prod-up22.9%
metadata-eval22.9%
Applied egg-rr22.9%
*-commutative22.9%
associate-/l*37.3%
Simplified37.3%
if -1e-142 < x < -8.50000000000000018e-296Initial program 3.1%
/-rgt-identity3.1%
associate-/r/3.1%
exp-neg3.1%
remove-double-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in x around inf 25.1%
if -8.50000000000000018e-296 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.0%
+-commutative39.0%
Simplified39.0%
Taylor expanded in x around inf 97.2%
add-sqr-sqrt96.6%
sqrt-unprod65.5%
pow265.5%
Applied egg-rr65.5%
unpow265.5%
rem-sqrt-square97.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
Final simplification73.2%
(FPCore (x)
:precision binary64
(if (<= x -1e-142)
(/ (fmod (* x (/ (+ -1.0 (pow x -2.0)) (+ -1.0 (/ 1.0 x)))) 1.0) (exp x))
(if (<= x -8.5e-296)
(fmod (* x (+ 1.0 (/ 1.0 x))) 1.0)
(/ (fabs (fmod x 1.0)) (exp x)))))
double code(double x) {
double tmp;
if (x <= -1e-142) {
tmp = fmod((x * ((-1.0 + pow(x, -2.0)) / (-1.0 + (1.0 / x)))), 1.0) / exp(x);
} else if (x <= -8.5e-296) {
tmp = fmod((x * (1.0 + (1.0 / x))), 1.0);
} else {
tmp = fabs(fmod(x, 1.0)) / exp(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1d-142)) then
tmp = mod((x * (((-1.0d0) + (x ** (-2.0d0))) / ((-1.0d0) + (1.0d0 / x)))), 1.0d0) / exp(x)
else if (x <= (-8.5d-296)) then
tmp = mod((x * (1.0d0 + (1.0d0 / x))), 1.0d0)
else
tmp = abs(mod(x, 1.0d0)) / exp(x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -1e-142: tmp = math.fmod((x * ((-1.0 + math.pow(x, -2.0)) / (-1.0 + (1.0 / x)))), 1.0) / math.exp(x) elif x <= -8.5e-296: tmp = math.fmod((x * (1.0 + (1.0 / x))), 1.0) else: tmp = math.fabs(math.fmod(x, 1.0)) / math.exp(x) return tmp
function code(x) tmp = 0.0 if (x <= -1e-142) tmp = Float64(rem(Float64(x * Float64(Float64(-1.0 + (x ^ -2.0)) / Float64(-1.0 + Float64(1.0 / x)))), 1.0) / exp(x)); elseif (x <= -8.5e-296) tmp = rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), 1.0); else tmp = Float64(abs(rem(x, 1.0)) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -1e-142], N[(N[With[{TMP1 = N[(x * N[(N[(-1.0 + N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision] / N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-296], N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[(N[Abs[N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-142}:\\
\;\;\;\;\frac{\left(\left(x \cdot \frac{-1 + {x}^{-2}}{-1 + \frac{1}{x}}\right) \bmod 1\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-296}:\\
\;\;\;\;\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\left(x \bmod 1\right)\right|}{e^{x}}\\
\end{array}
\end{array}
if x < -1e-142Initial program 15.2%
/-rgt-identity15.2%
associate-/r/15.2%
exp-neg15.2%
remove-double-neg15.2%
Simplified15.2%
Taylor expanded in x around 0 12.8%
+-commutative12.8%
Simplified12.8%
Taylor expanded in x around inf 17.6%
+-commutative17.6%
flip-+17.6%
inv-pow17.6%
inv-pow17.6%
pow-prod-up32.8%
metadata-eval32.8%
metadata-eval32.8%
Applied egg-rr32.8%
Taylor expanded in x around 0 32.8%
if -1e-142 < x < -8.50000000000000018e-296Initial program 3.1%
/-rgt-identity3.1%
associate-/r/3.1%
exp-neg3.1%
remove-double-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in x around inf 25.1%
if -8.50000000000000018e-296 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.0%
+-commutative39.0%
Simplified39.0%
Taylor expanded in x around inf 97.2%
add-sqr-sqrt96.6%
sqrt-unprod65.5%
pow265.5%
Applied egg-rr65.5%
unpow265.5%
rem-sqrt-square97.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
Final simplification72.5%
(FPCore (x) :precision binary64 (if (<= x -8.5e-296) (/ (fmod (* x (+ 1.0 (/ 1.0 x))) 1.0) (exp x)) (/ (fabs (fmod x 1.0)) (exp x))))
double code(double x) {
double tmp;
if (x <= -8.5e-296) {
tmp = fmod((x * (1.0 + (1.0 / x))), 1.0) / exp(x);
} else {
tmp = fabs(fmod(x, 1.0)) / exp(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-8.5d-296)) then
tmp = mod((x * (1.0d0 + (1.0d0 / x))), 1.0d0) / exp(x)
else
tmp = abs(mod(x, 1.0d0)) / exp(x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -8.5e-296: tmp = math.fmod((x * (1.0 + (1.0 / x))), 1.0) / math.exp(x) else: tmp = math.fabs(math.fmod(x, 1.0)) / math.exp(x) return tmp
function code(x) tmp = 0.0 if (x <= -8.5e-296) tmp = Float64(rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), 1.0) / exp(x)); else tmp = Float64(abs(rem(x, 1.0)) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -8.5e-296], N[(N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-296}:\\
\;\;\;\;\frac{\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod 1\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|\left(x \bmod 1\right)\right|}{e^{x}}\\
\end{array}
\end{array}
if x < -8.50000000000000018e-296Initial program 8.4%
/-rgt-identity8.4%
associate-/r/8.4%
exp-neg8.4%
remove-double-neg8.4%
Simplified8.4%
Taylor expanded in x around 0 7.4%
+-commutative7.4%
Simplified7.4%
Taylor expanded in x around inf 21.9%
Taylor expanded in x around 0 21.9%
if -8.50000000000000018e-296 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.0%
+-commutative39.0%
Simplified39.0%
Taylor expanded in x around inf 97.2%
add-sqr-sqrt96.6%
sqrt-unprod65.5%
pow265.5%
Applied egg-rr65.5%
unpow265.5%
rem-sqrt-square97.2%
Simplified97.2%
Taylor expanded in x around 0 97.2%
(FPCore (x) :precision binary64 (if (<= x -5e-309) (/ (fmod (* x (+ 1.0 (/ 1.0 x))) 1.0) (exp x)) (/ (fmod x 1.0) (exp x))))
double code(double x) {
double tmp;
if (x <= -5e-309) {
tmp = fmod((x * (1.0 + (1.0 / x))), 1.0) / exp(x);
} else {
tmp = fmod(x, 1.0) / exp(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-309)) then
tmp = mod((x * (1.0d0 + (1.0d0 / x))), 1.0d0) / exp(x)
else
tmp = mod(x, 1.0d0) / exp(x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-309: tmp = math.fmod((x * (1.0 + (1.0 / x))), 1.0) / math.exp(x) else: tmp = math.fmod(x, 1.0) / math.exp(x) return tmp
function code(x) tmp = 0.0 if (x <= -5e-309) tmp = Float64(rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), 1.0) / exp(x)); else tmp = Float64(rem(x, 1.0) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -5e-309], N[(N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod 1\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{e^{x}}\\
\end{array}
\end{array}
if x < -4.9999999999999995e-309Initial program 8.3%
/-rgt-identity8.3%
associate-/r/8.3%
exp-neg8.3%
remove-double-neg8.3%
Simplified8.3%
Taylor expanded in x around 0 7.3%
+-commutative7.3%
Simplified7.3%
Taylor expanded in x around inf 21.7%
Taylor expanded in x around 0 21.7%
if -4.9999999999999995e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around 0 97.8%
(FPCore (x) :precision binary64 (if (<= x -5e-309) (fmod (* x (+ 1.0 (/ 1.0 x))) 1.0) (/ (fmod x 1.0) (exp x))))
double code(double x) {
double tmp;
if (x <= -5e-309) {
tmp = fmod((x * (1.0 + (1.0 / x))), 1.0);
} else {
tmp = fmod(x, 1.0) / exp(x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-309)) then
tmp = mod((x * (1.0d0 + (1.0d0 / x))), 1.0d0)
else
tmp = mod(x, 1.0d0) / exp(x)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-309: tmp = math.fmod((x * (1.0 + (1.0 / x))), 1.0) else: tmp = math.fmod(x, 1.0) / math.exp(x) return tmp
function code(x) tmp = 0.0 if (x <= -5e-309) tmp = rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), 1.0); else tmp = Float64(rem(x, 1.0) / exp(x)); end return tmp end
code[x_] := If[LessEqual[x, -5e-309], N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{e^{x}}\\
\end{array}
\end{array}
if x < -4.9999999999999995e-309Initial program 8.3%
/-rgt-identity8.3%
associate-/r/8.3%
exp-neg8.3%
remove-double-neg8.3%
Simplified8.3%
Taylor expanded in x around 0 8.3%
Taylor expanded in x around 0 6.0%
Taylor expanded in x around 0 6.0%
+-commutative7.3%
Simplified6.0%
Taylor expanded in x around inf 20.4%
if -4.9999999999999995e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 39.3%
+-commutative39.3%
Simplified39.3%
Taylor expanded in x around inf 97.8%
Taylor expanded in x around 0 97.8%
(FPCore (x) :precision binary64 (if (<= x -5e-309) (fmod (* x (+ 1.0 (/ 1.0 x))) 1.0) (fmod x 1.0)))
double code(double x) {
double tmp;
if (x <= -5e-309) {
tmp = fmod((x * (1.0 + (1.0 / x))), 1.0);
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-309)) then
tmp = mod((x * (1.0d0 + (1.0d0 / x))), 1.0d0)
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-309: tmp = math.fmod((x * (1.0 + (1.0 / x))), 1.0) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= -5e-309) tmp = rem(Float64(x * Float64(1.0 + Float64(1.0 / x))), 1.0); else tmp = rem(x, 1.0); end return tmp end
code[x_] := If[LessEqual[x, -5e-309], N[With[{TMP1 = N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\left(\left(x \cdot \left(1 + \frac{1}{x}\right)\right) \bmod 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -4.9999999999999995e-309Initial program 8.3%
/-rgt-identity8.3%
associate-/r/8.3%
exp-neg8.3%
remove-double-neg8.3%
Simplified8.3%
Taylor expanded in x around 0 8.3%
Taylor expanded in x around 0 6.0%
Taylor expanded in x around 0 6.0%
+-commutative7.3%
Simplified6.0%
Taylor expanded in x around inf 20.4%
if -4.9999999999999995e-309 < x Initial program 5.5%
/-rgt-identity5.5%
associate-/r/5.5%
exp-neg5.5%
remove-double-neg5.5%
Simplified5.5%
Taylor expanded in x around 0 4.8%
Taylor expanded in x around 0 4.7%
Taylor expanded in x around 0 37.9%
+-commutative39.3%
Simplified37.9%
Taylor expanded in x around inf 96.5%
(FPCore (x) :precision binary64 (fmod x 1.0))
double code(double x) {
return fmod(x, 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(x, 1.0d0)
end function
def code(x): return math.fmod(x, 1.0)
function code(x) return rem(x, 1.0) end
code[x_] := N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}
\\
\left(x \bmod 1\right)
\end{array}
Initial program 6.6%
/-rgt-identity6.6%
associate-/r/6.6%
exp-neg6.6%
remove-double-neg6.6%
Simplified6.6%
Taylor expanded in x around 0 6.1%
Taylor expanded in x around 0 5.2%
Taylor expanded in x around 0 26.3%
+-commutative27.7%
Simplified26.3%
Taylor expanded in x around inf 62.3%
herbie shell --seed 2024118
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))