
(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 (fmod (exp x) (sqrt (cos x)))))
(if (<= (* t_0 (exp (- x))) 0.0)
(fmod (exp x) (+ (pow (sqrt 2.0) 2.0) -1.0))
(/ 1.0 (/ (exp x) t_0)))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double tmp;
if ((t_0 * exp(-x)) <= 0.0) {
tmp = fmod(exp(x), (pow(sqrt(2.0), 2.0) + -1.0));
} else {
tmp = 1.0 / (exp(x) / t_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)) <= 0.0d0) then
tmp = mod(exp(x), ((sqrt(2.0d0) ** 2.0d0) + (-1.0d0)))
else
tmp = 1.0d0 / (exp(x) / t_0)
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)) <= 0.0: tmp = math.fmod(math.exp(x), (math.pow(math.sqrt(2.0), 2.0) + -1.0)) else: tmp = 1.0 / (math.exp(x) / t_0) return tmp
function code(x) t_0 = rem(exp(x), sqrt(cos(x))) tmp = 0.0 if (Float64(t_0 * exp(Float64(-x))) <= 0.0) tmp = rem(exp(x), Float64((sqrt(2.0) ^ 2.0) + -1.0)); else tmp = Float64(1.0 / Float64(exp(x) / t_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], 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[(1.0 / N[(N[Exp[x], $MachinePrecision] / t$95$0), $MachinePrecision]), $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 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left({\left(\sqrt{2}\right)}^{2} + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{e^{x}}{t_0}}\\
\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.2%
exp-neg4.2%
associate-*r/4.2%
*-rgt-identity4.2%
Simplified4.2%
expm1-log1p-u4.2%
expm1-udef4.2%
log1p-udef4.2%
add-exp-log4.2%
Applied egg-rr4.2%
add-sqr-sqrt49.4%
pow249.4%
add-sqr-sqrt49.4%
hypot-1-def49.4%
pow1/249.4%
sqrt-pow149.4%
metadata-eval49.4%
Applied egg-rr49.4%
Taylor expanded in x around 0 49.4%
Taylor expanded in x around 0 49.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 23.6%
exp-neg23.7%
associate-*r/23.8%
*-rgt-identity23.8%
Simplified23.8%
add-cbrt-cube23.8%
pow1/323.8%
pow323.8%
Applied egg-rr23.8%
unpow1/323.8%
rem-cbrt-cube23.8%
clear-num23.8%
Applied egg-rr23.8%
Final simplification44.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (fmod (exp x) (sqrt (cos x)))))
(if (<= (* t_0 (exp (- x))) 0.0)
(fmod (exp x) (+ (pow (sqrt 2.0) 2.0) -1.0))
(/ t_0 (exp x)))))
double code(double x) {
double t_0 = fmod(exp(x), sqrt(cos(x)));
double tmp;
if ((t_0 * exp(-x)) <= 0.0) {
tmp = fmod(exp(x), (pow(sqrt(2.0), 2.0) + -1.0));
} else {
tmp = t_0 / exp(x);
}
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)) <= 0.0d0) then
tmp = mod(exp(x), ((sqrt(2.0d0) ** 2.0d0) + (-1.0d0)))
else
tmp = t_0 / exp(x)
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)) <= 0.0: tmp = math.fmod(math.exp(x), (math.pow(math.sqrt(2.0), 2.0) + -1.0)) else: tmp = t_0 / math.exp(x) return tmp
function code(x) t_0 = rem(exp(x), sqrt(cos(x))) tmp = 0.0 if (Float64(t_0 * exp(Float64(-x))) <= 0.0) tmp = rem(exp(x), Float64((sqrt(2.0) ^ 2.0) + -1.0)); else tmp = Float64(t_0 / exp(x)); 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], 0.0], N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision], N[(t$95$0 / N[Exp[x], $MachinePrecision]), $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 0:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left({\left(\sqrt{2}\right)}^{2} + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{e^{x}}\\
\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.2%
exp-neg4.2%
associate-*r/4.2%
*-rgt-identity4.2%
Simplified4.2%
expm1-log1p-u4.2%
expm1-udef4.2%
log1p-udef4.2%
add-exp-log4.2%
Applied egg-rr4.2%
add-sqr-sqrt49.4%
pow249.4%
add-sqr-sqrt49.4%
hypot-1-def49.4%
pow1/249.4%
sqrt-pow149.4%
metadata-eval49.4%
Applied egg-rr49.4%
Taylor expanded in x around 0 49.4%
Taylor expanded in x around 0 49.4%
if 0.0 < (*.f64 (fmod.f64 (exp.f64 x) (sqrt.f64 (cos.f64 x))) (exp.f64 (neg.f64 x))) Initial program 23.6%
exp-neg23.7%
associate-*r/23.8%
*-rgt-identity23.8%
Simplified23.8%
Final simplification44.0%
(FPCore (x) :precision binary64 (/ (fmod (exp x) (+ (pow (hypot 1.0 (pow (cos x) 0.25)) 2.0) -1.0)) (exp x)))
double code(double x) {
return fmod(exp(x), (pow(hypot(1.0, pow(cos(x), 0.25)), 2.0) + -1.0)) / exp(x);
}
def code(x): return math.fmod(math.exp(x), (math.pow(math.hypot(1.0, math.pow(math.cos(x), 0.25)), 2.0) + -1.0)) / math.exp(x)
function code(x) return Float64(rem(exp(x), Float64((hypot(1.0, (cos(x) ^ 0.25)) ^ 2.0) + -1.0)) / exp(x)) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[Power[N[Sqrt[1.0 ^ 2 + N[Power[N[Cos[x], $MachinePrecision], 0.25], $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(e^{x}\right) \bmod \left({\left(\mathsf{hypot}\left(1, {\cos x}^{0.25}\right)\right)}^{2} + -1\right)\right)}{e^{x}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
add-exp-log8.3%
Applied egg-rr8.3%
add-sqr-sqrt43.8%
pow243.8%
add-sqr-sqrt43.8%
hypot-1-def43.8%
pow1/243.8%
sqrt-pow143.8%
metadata-eval43.8%
Applied egg-rr43.8%
Final simplification43.8%
(FPCore (x) :precision binary64 (/ (fmod (exp x) (+ (pow (sqrt 2.0) 2.0) -1.0)) (exp x)))
double code(double x) {
return fmod(exp(x), (pow(sqrt(2.0), 2.0) + -1.0)) / exp(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), ((sqrt(2.0d0) ** 2.0d0) + (-1.0d0))) / exp(x)
end function
def code(x): return math.fmod(math.exp(x), (math.pow(math.sqrt(2.0), 2.0) + -1.0)) / math.exp(x)
function code(x) return Float64(rem(exp(x), Float64((sqrt(2.0) ^ 2.0) + -1.0)) / exp(x)) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(e^{x}\right) \bmod \left({\left(\sqrt{2}\right)}^{2} + -1\right)\right)}{e^{x}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
add-exp-log8.3%
Applied egg-rr8.3%
add-sqr-sqrt43.8%
pow243.8%
add-sqr-sqrt43.8%
hypot-1-def43.8%
pow1/243.8%
sqrt-pow143.8%
metadata-eval43.8%
Applied egg-rr43.8%
Taylor expanded in x around 0 43.6%
Final simplification43.6%
(FPCore (x) :precision binary64 (fmod (exp x) (+ (pow (sqrt 2.0) 2.0) -1.0)))
double code(double x) {
return fmod(exp(x), (pow(sqrt(2.0), 2.0) + -1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), ((sqrt(2.0d0) ** 2.0d0) + (-1.0d0)))
end function
def code(x): return math.fmod(math.exp(x), (math.pow(math.sqrt(2.0), 2.0) + -1.0))
function code(x) return rem(exp(x), Float64((sqrt(2.0) ^ 2.0) + -1.0)) end
code[x_] := N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}
\\
\left(\left(e^{x}\right) \bmod \left({\left(\sqrt{2}\right)}^{2} + -1\right)\right)
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
add-exp-log8.3%
Applied egg-rr8.3%
add-sqr-sqrt43.8%
pow243.8%
add-sqr-sqrt43.8%
hypot-1-def43.8%
pow1/243.8%
sqrt-pow143.8%
metadata-eval43.8%
Applied egg-rr43.8%
Taylor expanded in x around 0 43.6%
Taylor expanded in x around 0 42.0%
Final simplification42.0%
(FPCore (x) :precision binary64 (/ (fmod (exp x) (+ (+ 1.0 (+ 1.0 (* (* x x) -0.25))) -1.0)) (exp x)))
double code(double x) {
return fmod(exp(x), ((1.0 + (1.0 + ((x * x) * -0.25))) + -1.0)) / exp(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), ((1.0d0 + (1.0d0 + ((x * x) * (-0.25d0)))) + (-1.0d0))) / exp(x)
end function
def code(x): return math.fmod(math.exp(x), ((1.0 + (1.0 + ((x * x) * -0.25))) + -1.0)) / math.exp(x)
function code(x) return Float64(rem(exp(x), Float64(Float64(1.0 + Float64(1.0 + Float64(Float64(x * x) * -0.25))) + -1.0)) / exp(x)) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(1.0 + N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(e^{x}\right) \bmod \left(\left(1 + \left(1 + \left(x \cdot x\right) \cdot -0.25\right)\right) + -1\right)\right)}{e^{x}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
add-exp-log8.3%
Applied egg-rr8.3%
Taylor expanded in x around 0 8.3%
*-commutative8.2%
unpow28.2%
Simplified8.3%
Final simplification8.3%
(FPCore (x) :precision binary64 (/ (fmod (exp x) (+ (+ 2.0 (* (* x x) -0.25)) -1.0)) (exp x)))
double code(double x) {
return fmod(exp(x), ((2.0 + ((x * x) * -0.25)) + -1.0)) / exp(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), ((2.0d0 + ((x * x) * (-0.25d0))) + (-1.0d0))) / exp(x)
end function
def code(x): return math.fmod(math.exp(x), ((2.0 + ((x * x) * -0.25)) + -1.0)) / math.exp(x)
function code(x) return Float64(rem(exp(x), Float64(Float64(2.0 + Float64(Float64(x * x) * -0.25)) + -1.0)) / exp(x)) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(2.0 + N[(N[(x * x), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(e^{x}\right) \bmod \left(\left(2 + \left(x \cdot x\right) \cdot -0.25\right) + -1\right)\right)}{e^{x}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
add-exp-log8.3%
Applied egg-rr8.3%
Taylor expanded in x around 0 8.2%
*-commutative8.2%
unpow28.2%
Simplified8.2%
Final simplification8.2%
(FPCore (x) :precision binary64 (/ (fmod (exp x) (+ 1.0 (* (* x x) -0.25))) (exp x)))
double code(double x) {
return fmod(exp(x), (1.0 + ((x * x) * -0.25))) / exp(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), (1.0d0 + ((x * x) * (-0.25d0)))) / exp(x)
end function
def code(x): return math.fmod(math.exp(x), (1.0 + ((x * x) * -0.25))) / math.exp(x)
function code(x) return Float64(rem(exp(x), Float64(1.0 + Float64(Float64(x * x) * -0.25))) / exp(x)) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(e^{x}\right) \bmod \left(1 + \left(x \cdot x\right) \cdot -0.25\right)\right)}{e^{x}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
Taylor expanded in x around 0 8.2%
*-commutative8.2%
unpow28.2%
Simplified8.2%
Final simplification8.2%
(FPCore (x) :precision binary64 (+ 1.0 (+ (/ (fmod (exp x) 1.0) (exp x)) -1.0)))
double code(double x) {
return 1.0 + ((fmod(exp(x), 1.0) / exp(x)) + -1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 + ((mod(exp(x), 1.0d0) / exp(x)) + (-1.0d0))
end function
def code(x): return 1.0 + ((math.fmod(math.exp(x), 1.0) / math.exp(x)) + -1.0)
function code(x) return Float64(1.0 + Float64(Float64(rem(exp(x), 1.0) / exp(x)) + -1.0)) end
code[x_] := N[(1.0 + N[(N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(\frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}} + -1\right)
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
add-exp-log8.3%
Applied egg-rr8.3%
associate--l+8.3%
Simplified8.3%
Taylor expanded in x around 0 8.0%
Final simplification8.0%
(FPCore (x) :precision binary64 (+ (+ 1.0 (/ (fmod (exp x) 1.0) (exp x))) -1.0))
double code(double x) {
return (1.0 + (fmod(exp(x), 1.0) / exp(x))) + -1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 + (mod(exp(x), 1.0d0) / exp(x))) + (-1.0d0)
end function
def code(x): return (1.0 + (math.fmod(math.exp(x), 1.0) / math.exp(x))) + -1.0
function code(x) return Float64(Float64(1.0 + Float64(rem(exp(x), 1.0) / exp(x))) + -1.0) end
code[x_] := N[(N[(1.0 + N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + \frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}}\right) + -1
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
add-cbrt-cube8.3%
pow1/38.3%
pow38.3%
Applied egg-rr8.3%
unpow1/38.3%
rem-cbrt-cube8.3%
expm1-log1p-u8.3%
expm1-udef8.3%
log1p-udef8.3%
+-commutative8.3%
add-exp-log8.3%
Applied egg-rr8.3%
Taylor expanded in x around 0 8.0%
Final simplification8.0%
(FPCore (x) :precision binary64 (/ 1.0 (/ (exp x) (fmod (exp x) 1.0))))
double code(double x) {
return 1.0 / (exp(x) / fmod(exp(x), 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (exp(x) / mod(exp(x), 1.0d0))
end function
def code(x): return 1.0 / (math.exp(x) / math.fmod(math.exp(x), 1.0))
function code(x) return Float64(1.0 / Float64(exp(x) / rem(exp(x), 1.0))) end
code[x_] := N[(1.0 / N[(N[Exp[x], $MachinePrecision] / N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{e^{x}}{\left(\left(e^{x}\right) \bmod 1\right)}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
Taylor expanded in x around 0 8.0%
div-inv8.0%
rec-exp7.9%
Applied egg-rr7.9%
exp-neg8.0%
div-inv8.0%
clear-num8.0%
Applied egg-rr8.0%
Final simplification8.0%
(FPCore (x) :precision binary64 (/ (fmod (exp x) 1.0) (exp x)))
double code(double x) {
return fmod(exp(x), 1.0) / exp(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), 1.0d0) / exp(x)
end function
def code(x): return math.fmod(math.exp(x), 1.0) / math.exp(x)
function code(x) return Float64(rem(exp(x), 1.0) / exp(x)) end
code[x_] := N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}}
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
Taylor expanded in x around 0 8.0%
Final simplification8.0%
(FPCore (x) :precision binary64 (fmod (exp x) 1.0))
double code(double x) {
return fmod(exp(x), 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod(exp(x), 1.0d0)
end function
def code(x): return math.fmod(math.exp(x), 1.0)
function code(x) return rem(exp(x), 1.0) end
code[x_] := N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}
\\
\left(\left(e^{x}\right) \bmod 1\right)
\end{array}
Initial program 8.3%
exp-neg8.3%
associate-*r/8.3%
*-rgt-identity8.3%
Simplified8.3%
Taylor expanded in x around 0 8.0%
Taylor expanded in x around 0 6.4%
Final simplification6.4%
herbie shell --seed 2023203
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))