| Alternative 1 | |
|---|---|
| Error | 59.5 |
| Cost | 32256 |
\[\frac{\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right)}{e^{x}}
\]
(FPCore (x) :precision binary64 (* (fmod (exp x) (sqrt (cos x))) (exp (- x))))
(FPCore (x) :precision binary64 (let* ((t_0 (expm1 (- (log (fmod (exp x) 1.0)) x)))) (/ (- 1.0 (* t_0 (expm1 (- x)))) (- 1.0 t_0))))
double code(double x) {
return fmod(exp(x), sqrt(cos(x))) * exp(-x);
}
double code(double x) {
double t_0 = expm1((log(fmod(exp(x), 1.0)) - x));
return (1.0 - (t_0 * expm1(-x))) / (1.0 - t_0);
}
def code(x): return math.fmod(math.exp(x), math.sqrt(math.cos(x))) * math.exp(-x)
def code(x): t_0 = math.expm1((math.log(math.fmod(math.exp(x), 1.0)) - x)) return (1.0 - (t_0 * math.expm1(-x))) / (1.0 - t_0)
function code(x) return Float64(rem(exp(x), sqrt(cos(x))) * exp(Float64(-x))) end
function code(x) t_0 = expm1(Float64(log(rem(exp(x), 1.0)) - x)) return Float64(Float64(1.0 - Float64(t_0 * expm1(Float64(-x)))) / Float64(1.0 - t_0)) 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_] := Block[{t$95$0 = N[(Exp[N[(N[Log[N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]], $MachinePrecision] - x), $MachinePrecision]] - 1), $MachinePrecision]}, N[(N[(1.0 - N[(t$95$0 * N[(Exp[(-x)] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]
\left(\left(e^{x}\right) \bmod \left(\sqrt{\cos x}\right)\right) \cdot e^{-x}
\begin{array}{l}
t_0 := \mathsf{expm1}\left(\log \left(\left(e^{x}\right) \bmod 1\right) - x\right)\\
\frac{1 - t_0 \cdot \mathsf{expm1}\left(-x\right)}{1 - t_0}
\end{array}
Initial program 59.6
Simplified59.5
Taylor expanded in x around 0 59.9
Applied egg-rr59.9
Applied egg-rr59.9
Taylor expanded in x around inf 56.5
Simplified56.5
Final simplification56.5
| Alternative 1 | |
|---|---|
| Error | 59.5 |
| Cost | 32256 |
| Alternative 2 | |
|---|---|
| Error | 59.7 |
| Cost | 19840 |
| Alternative 3 | |
|---|---|
| Error | 59.9 |
| Cost | 19456 |
| Alternative 4 | |
|---|---|
| Error | 60.2 |
| Cost | 13568 |
| Alternative 5 | |
|---|---|
| Error | 60.2 |
| Cost | 13440 |
| Alternative 6 | |
|---|---|
| Error | 60.2 |
| Cost | 13184 |
| Alternative 7 | |
|---|---|
| Error | 60.5 |
| Cost | 12928 |
herbie shell --seed 2022337
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))