| Alternative 1 | |
|---|---|
| Accuracy | 42.7% |
| Cost | 64 |
\[1
\]
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
(FPCore (x) :precision binary64 (if (<= x -2e-15) 1.0 (exp (- x))))
double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
double code(double x) {
double tmp;
if (x <= -2e-15) {
tmp = 1.0;
} else {
tmp = exp(-x);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), sqrt(cos(x))) * exp(-x)
end function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-2d-15)) then
tmp = 1.0d0
else
tmp = exp(-x)
end if
code = tmp
end function
def code(x): return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
def code(x): tmp = 0 if x <= -2e-15: tmp = 1.0 else: tmp = math.exp(-x) return tmp
function code(x) return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) end
function code(x) tmp = 0.0 if (x <= -2e-15) tmp = 1.0; else tmp = exp(Float64(-x)); end return tmp 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]
code[x_] := If[LessEqual[x, -2e-15], 1.0, N[Exp[(-x)], $MachinePrecision]]
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;e^{-x}\\
\end{array}
if x < -2.0000000000000002e-15Initial program 80.3%
Simplified80.6%
[Start]80.3 | \[ \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\] |
|---|---|
exp-neg [=>]80.5 | \[ \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}}
\] |
associate-*r/ [=>]80.6 | \[ \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{e^{x}}}
\] |
*-rgt-identity [=>]80.6 | \[ \frac{\color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}{e^{x}}
\] |
Taylor expanded in x around 0 80.3%
Simplified80.3%
[Start]80.3 | \[ \frac{\left(\left(e^{x}\right) \bmod \left(1 + -0.25 \cdot {x}^{2}\right)\right)}{e^{x}}
\] |
|---|---|
*-commutative [=>]80.3 | \[ \frac{\left(\left(e^{x}\right) \bmod \left(1 + \color{blue}{{x}^{2} \cdot -0.25}\right)\right)}{e^{x}}
\] |
unpow2 [=>]80.3 | \[ \frac{\left(\left(e^{x}\right) \bmod \left(1 + \color{blue}{\left(x \cdot x\right)} \cdot -0.25\right)\right)}{e^{x}}
\] |
Applied egg-rr80.9%
Applied egg-rr80.9%
Taylor expanded in x around inf 99.6%
if -2.0000000000000002e-15 < x Initial program 4.9%
Simplified4.9%
[Start]4.9 | \[ \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\] |
|---|---|
exp-neg [=>]4.9 | \[ \left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot \color{blue}{\frac{1}{e^{x}}}
\] |
associate-*r/ [=>]4.9 | \[ \color{blue}{\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot 1}{e^{x}}}
\] |
*-rgt-identity [=>]4.9 | \[ \frac{\color{blue}{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}}{e^{x}}
\] |
Applied egg-rr4.9%
Taylor expanded in x around inf 60.5%
Simplified60.5%
[Start]60.5 | \[ e^{-1 \cdot x}
\] |
|---|---|
mul-1-neg [=>]60.5 | \[ e^{\color{blue}{-x}}
\] |
Final simplification61.6%
| Alternative 1 | |
|---|---|
| Accuracy | 42.7% |
| Cost | 64 |
herbie shell --seed 2023129
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))