
(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 6 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 (+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))))
(if (<= x -7.5e-155)
(/
(fmod
(* (* x x) (+ (/ 1.0 x) (+ 0.5 (/ 1.0 (* x x)))))
(+ 1.0 (* x (* x (+ -0.25 (* x (* x -0.010416666666666666)))))))
t_0)
(/ (fmod x 1.0) t_0))))
double code(double x) {
double t_0 = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))));
double tmp;
if (x <= -7.5e-155) {
tmp = fmod(((x * x) * ((1.0 / x) + (0.5 + (1.0 / (x * x))))), (1.0 + (x * (x * (-0.25 + (x * (x * -0.010416666666666666))))))) / t_0;
} else {
tmp = fmod(x, 1.0) / t_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 + (x * 0.16666666666666666d0)))))
if (x <= (-7.5d-155)) then
tmp = mod(((x * x) * ((1.0d0 / x) + (0.5d0 + (1.0d0 / (x * x))))), (1.0d0 + (x * (x * ((-0.25d0) + (x * (x * (-0.010416666666666666d0)))))))) / t_0
else
tmp = mod(x, 1.0d0) / t_0
end if
code = tmp
end function
def code(x): t_0 = 1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) tmp = 0 if x <= -7.5e-155: tmp = math.fmod(((x * x) * ((1.0 / x) + (0.5 + (1.0 / (x * x))))), (1.0 + (x * (x * (-0.25 + (x * (x * -0.010416666666666666))))))) / t_0 else: tmp = math.fmod(x, 1.0) / t_0 return tmp
function code(x) t_0 = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))) tmp = 0.0 if (x <= -7.5e-155) tmp = Float64(rem(Float64(Float64(x * x) * Float64(Float64(1.0 / x) + Float64(0.5 + Float64(1.0 / Float64(x * x))))), Float64(1.0 + Float64(x * Float64(x * Float64(-0.25 + Float64(x * Float64(x * -0.010416666666666666))))))) / t_0); else tmp = Float64(rem(x, 1.0) / t_0); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-155], N[(N[With[{TMP1 = N[(N[(x * x), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] + N[(0.5 + N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = N[(1.0 + N[(x * N[(x * N[(-0.25 + N[(x * N[(x * -0.010416666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-155}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot \left(\frac{1}{x} + \left(0.5 + \frac{1}{x \cdot x}\right)\right)\right) \bmod \left(1 + x \cdot \left(x \cdot \left(-0.25 + x \cdot \left(x \cdot -0.010416666666666666\right)\right)\right)\right)\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{t\_0}\\
\end{array}
\end{array}
if x < -7.5000000000000006e-155Initial program 17.6%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f6417.7%
Simplified17.7%
Taylor expanded in x around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6417.7%
Simplified17.7%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6415.8%
Simplified15.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6414.8%
Simplified14.8%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6425.5%
Simplified25.5%
if -7.5000000000000006e-155 < x Initial program 4.4%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f644.4%
Simplified4.4%
Taylor expanded in x around 0
Simplified3.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f643.9%
Simplified3.9%
Taylor expanded in x around 0
+-lowering-+.f6428.1%
Simplified28.1%
Taylor expanded in x around inf
Simplified70.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* x (+ 1.0 (* x 0.5))))))
(if (<= x -2e-310)
(/
(fmod
t_0
(+ 1.0 (* x (* x (+ -0.25 (* x (* x -0.010416666666666666)))))))
t_0)
(/
(fmod x 1.0)
(+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))))))
double code(double x) {
double t_0 = 1.0 + (x * (1.0 + (x * 0.5)));
double tmp;
if (x <= -2e-310) {
tmp = fmod(t_0, (1.0 + (x * (x * (-0.25 + (x * (x * -0.010416666666666666))))))) / t_0;
} else {
tmp = fmod(x, 1.0) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))));
}
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 <= (-2d-310)) then
tmp = mod(t_0, (1.0d0 + (x * (x * ((-0.25d0) + (x * (x * (-0.010416666666666666d0)))))))) / t_0
else
tmp = mod(x, 1.0d0) / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))))
end if
code = tmp
end function
def code(x): t_0 = 1.0 + (x * (1.0 + (x * 0.5))) tmp = 0 if x <= -2e-310: tmp = math.fmod(t_0, (1.0 + (x * (x * (-0.25 + (x * (x * -0.010416666666666666))))))) / t_0 else: tmp = math.fmod(x, 1.0) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))) return tmp
function code(x) t_0 = Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))) tmp = 0.0 if (x <= -2e-310) tmp = Float64(rem(t_0, Float64(1.0 + Float64(x * Float64(x * Float64(-0.25 + Float64(x * Float64(x * -0.010416666666666666))))))) / t_0); else tmp = Float64(rem(x, 1.0) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))))); 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, -2e-310], N[(N[With[{TMP1 = t$95$0, TMP2 = N[(1.0 + N[(x * N[(x * N[(-0.25 + N[(x * N[(x * -0.010416666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + x \cdot \left(1 + x \cdot 0.5\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(t\_0 \bmod \left(1 + x \cdot \left(x \cdot \left(-0.25 + x \cdot \left(x \cdot -0.010416666666666666\right)\right)\right)\right)\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if x < -1.999999999999994e-310Initial program 10.2%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f6410.3%
Simplified10.3%
Taylor expanded in x around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6410.3%
Simplified10.3%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f649.3%
Simplified9.3%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f648.8%
Simplified8.8%
Taylor expanded in x around 0
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-+r+N/A
+-lowering-+.f64N/A
*-rgt-identityN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
cancel-sign-sub-invN/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6411.2%
Simplified11.2%
if -1.999999999999994e-310 < x Initial program 4.8%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f644.8%
Simplified4.8%
Taylor expanded in x around 0
Simplified4.2%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f644.2%
Simplified4.2%
Taylor expanded in x around 0
+-lowering-+.f6437.3%
Simplified37.3%
Taylor expanded in x around inf
Simplified96.2%
(FPCore (x)
:precision binary64
(if (<= x -2e-310)
(/ (fmod (+ x 1.0) 1.0) (+ x 1.0))
(/
(fmod x 1.0)
(+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))))
double code(double x) {
double tmp;
if (x <= -2e-310) {
tmp = fmod((x + 1.0), 1.0) / (x + 1.0);
} else {
tmp = fmod(x, 1.0) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-2d-310)) then
tmp = mod((x + 1.0d0), 1.0d0) / (x + 1.0d0)
else
tmp = mod(x, 1.0d0) / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))))
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -2e-310: tmp = math.fmod((x + 1.0), 1.0) / (x + 1.0) else: tmp = math.fmod(x, 1.0) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))) return tmp
function code(x) tmp = 0.0 if (x <= -2e-310) tmp = Float64(rem(Float64(x + 1.0), 1.0) / Float64(x + 1.0)); else tmp = Float64(rem(x, 1.0) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))))); end return tmp end
code[x_] := If[LessEqual[x, -2e-310], N[(N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[With[{TMP1 = x, TMP2 = 1.0}, 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\left(x + 1\right) \bmod 1\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \bmod 1\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if x < -1.999999999999994e-310Initial program 10.2%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f6410.3%
Simplified10.3%
Taylor expanded in x around 0
Simplified10.3%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f649.3%
Simplified9.3%
Taylor expanded in x around 0
+-lowering-+.f648.4%
Simplified8.4%
Taylor expanded in x around 0
+-lowering-+.f649.6%
Simplified9.6%
if -1.999999999999994e-310 < x Initial program 4.8%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f644.8%
Simplified4.8%
Taylor expanded in x around 0
Simplified4.2%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f644.2%
Simplified4.2%
Taylor expanded in x around 0
+-lowering-+.f6437.3%
Simplified37.3%
Taylor expanded in x around inf
Simplified96.2%
Final simplification59.7%
(FPCore (x) :precision binary64 (/ (fmod (+ x 1.0) 1.0) (+ x 1.0)))
double code(double x) {
return fmod((x + 1.0), 1.0) / (x + 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod((x + 1.0d0), 1.0d0) / (x + 1.0d0)
end function
def code(x): return math.fmod((x + 1.0), 1.0) / (x + 1.0)
function code(x) return Float64(rem(Float64(x + 1.0), 1.0) / Float64(x + 1.0)) end
code[x_] := N[(N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + 1\right) \bmod 1\right)}{x + 1}
\end{array}
Initial program 7.1%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f647.1%
Simplified7.1%
Taylor expanded in x around 0
Simplified6.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f646.4%
Simplified6.4%
Taylor expanded in x around 0
+-lowering-+.f6425.1%
Simplified25.1%
Taylor expanded in x around 0
+-lowering-+.f6425.6%
Simplified25.6%
Final simplification25.6%
(FPCore (x) :precision binary64 (fmod (+ x 1.0) 1.0))
double code(double x) {
return fmod((x + 1.0), 1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = mod((x + 1.0d0), 1.0d0)
end function
def code(x): return math.fmod((x + 1.0), 1.0)
function code(x) return rem(Float64(x + 1.0), 1.0) end
code[x_] := N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + 1\right) \bmod 1\right)
\end{array}
Initial program 7.1%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f647.1%
Simplified7.1%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f645.5%
Simplified5.5%
Taylor expanded in x around 0
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6424.6%
Simplified24.6%
Final simplification24.6%
(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 7.1%
exp-negN/A
associate-*r/N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f64N/A
sqrt-lowering-sqrt.f64N/A
cos-lowering-cos.f64N/A
exp-lowering-exp.f647.1%
Simplified7.1%
Taylor expanded in x around 0
Simplified24.2%
Taylor expanded in x around 0
Simplified23.9%
Taylor expanded in x around 0
fmod-lowering-fmod.f6424.0%
Simplified24.0%
herbie shell --seed 2024149
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))