
(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 10 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 (+ 0.010416666666666666 (/ 0.25 (* x x))))
(t_1 (/ t_0 (* x x)))
(t_2 (+ t_1 -0.003298611111111111))
(t_3 (* x (* x x)))
(t_4 (* (* x x) (* x t_3)))
(t_5 (exp (- 0.0 x))))
(if (<= x -5.6e-17)
(/ (fmod (exp x) 1.0) (exp x))
(if (<= x -2.1e-39)
(*
(fmod
(exp x)
(/
(* t_4 (- -3.589164409454304e-8 (/ (* t_0 (* t_0 t_0)) t_4)))
(+ 1.0880835262345679e-5 (* t_1 t_2))))
t_5)
(if (<= x -1.16e-54)
(*
t_5
(fmod
(exp x)
(/ (* t_4 (- 1.0880835262345679e-5 (/ (* t_0 t_1) (* x x)))) t_2)))
(if (<= x -1.35e-108)
(* t_5 (fmod (exp x) (* t_3 (* t_3 (- -0.003298611111111111 t_1)))))
(fmod x 1.0)))))))
double code(double x) {
double t_0 = 0.010416666666666666 + (0.25 / (x * x));
double t_1 = t_0 / (x * x);
double t_2 = t_1 + -0.003298611111111111;
double t_3 = x * (x * x);
double t_4 = (x * x) * (x * t_3);
double t_5 = exp((0.0 - x));
double tmp;
if (x <= -5.6e-17) {
tmp = fmod(exp(x), 1.0) / exp(x);
} else if (x <= -2.1e-39) {
tmp = fmod(exp(x), ((t_4 * (-3.589164409454304e-8 - ((t_0 * (t_0 * t_0)) / t_4))) / (1.0880835262345679e-5 + (t_1 * t_2)))) * t_5;
} else if (x <= -1.16e-54) {
tmp = t_5 * fmod(exp(x), ((t_4 * (1.0880835262345679e-5 - ((t_0 * t_1) / (x * x)))) / t_2));
} else if (x <= -1.35e-108) {
tmp = t_5 * fmod(exp(x), (t_3 * (t_3 * (-0.003298611111111111 - t_1))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = 0.010416666666666666d0 + (0.25d0 / (x * x))
t_1 = t_0 / (x * x)
t_2 = t_1 + (-0.003298611111111111d0)
t_3 = x * (x * x)
t_4 = (x * x) * (x * t_3)
t_5 = exp((0.0d0 - x))
if (x <= (-5.6d-17)) then
tmp = mod(exp(x), 1.0d0) / exp(x)
else if (x <= (-2.1d-39)) then
tmp = mod(exp(x), ((t_4 * ((-3.589164409454304d-8) - ((t_0 * (t_0 * t_0)) / t_4))) / (1.0880835262345679d-5 + (t_1 * t_2)))) * t_5
else if (x <= (-1.16d-54)) then
tmp = t_5 * mod(exp(x), ((t_4 * (1.0880835262345679d-5 - ((t_0 * t_1) / (x * x)))) / t_2))
else if (x <= (-1.35d-108)) then
tmp = t_5 * mod(exp(x), (t_3 * (t_3 * ((-0.003298611111111111d0) - t_1))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = 0.010416666666666666 + (0.25 / (x * x)) t_1 = t_0 / (x * x) t_2 = t_1 + -0.003298611111111111 t_3 = x * (x * x) t_4 = (x * x) * (x * t_3) t_5 = math.exp((0.0 - x)) tmp = 0 if x <= -5.6e-17: tmp = math.fmod(math.exp(x), 1.0) / math.exp(x) elif x <= -2.1e-39: tmp = math.fmod(math.exp(x), ((t_4 * (-3.589164409454304e-8 - ((t_0 * (t_0 * t_0)) / t_4))) / (1.0880835262345679e-5 + (t_1 * t_2)))) * t_5 elif x <= -1.16e-54: tmp = t_5 * math.fmod(math.exp(x), ((t_4 * (1.0880835262345679e-5 - ((t_0 * t_1) / (x * x)))) / t_2)) elif x <= -1.35e-108: tmp = t_5 * math.fmod(math.exp(x), (t_3 * (t_3 * (-0.003298611111111111 - t_1)))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) t_0 = Float64(0.010416666666666666 + Float64(0.25 / Float64(x * x))) t_1 = Float64(t_0 / Float64(x * x)) t_2 = Float64(t_1 + -0.003298611111111111) t_3 = Float64(x * Float64(x * x)) t_4 = Float64(Float64(x * x) * Float64(x * t_3)) t_5 = exp(Float64(0.0 - x)) tmp = 0.0 if (x <= -5.6e-17) tmp = Float64(rem(exp(x), 1.0) / exp(x)); elseif (x <= -2.1e-39) tmp = Float64(rem(exp(x), Float64(Float64(t_4 * Float64(-3.589164409454304e-8 - Float64(Float64(t_0 * Float64(t_0 * t_0)) / t_4))) / Float64(1.0880835262345679e-5 + Float64(t_1 * t_2)))) * t_5); elseif (x <= -1.16e-54) tmp = Float64(t_5 * rem(exp(x), Float64(Float64(t_4 * Float64(1.0880835262345679e-5 - Float64(Float64(t_0 * t_1) / Float64(x * x)))) / t_2))); elseif (x <= -1.35e-108) tmp = Float64(t_5 * rem(exp(x), Float64(t_3 * Float64(t_3 * Float64(-0.003298611111111111 - t_1))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(0.010416666666666666 + N[(0.25 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + -0.003298611111111111), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * x), $MachinePrecision] * N[(x * t$95$3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5.6e-17], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.1e-39], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(t$95$4 * N[(-3.589164409454304e-8 - N[(N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0880835262345679e-5 + N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[x, -1.16e-54], N[(t$95$5 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(t$95$4 * N[(1.0880835262345679e-5 - N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e-108], N[(t$95$5 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(t$95$3 * N[(t$95$3 * N[(-0.003298611111111111 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.010416666666666666 + \frac{0.25}{x \cdot x}\\
t_1 := \frac{t\_0}{x \cdot x}\\
t_2 := t\_1 + -0.003298611111111111\\
t_3 := x \cdot \left(x \cdot x\right)\\
t_4 := \left(x \cdot x\right) \cdot \left(x \cdot t\_3\right)\\
t_5 := e^{0 - x}\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-39}:\\
\;\;\;\;\left(\left(e^{x}\right) \bmod \left(\frac{t\_4 \cdot \left(-3.589164409454304 \cdot 10^{-8} - \frac{t\_0 \cdot \left(t\_0 \cdot t\_0\right)}{t\_4}\right)}{1.0880835262345679 \cdot 10^{-5} + t\_1 \cdot t\_2}\right)\right) \cdot t\_5\\
\mathbf{elif}\;x \leq -1.16 \cdot 10^{-54}:\\
\;\;\;\;t\_5 \cdot \left(\left(e^{x}\right) \bmod \left(\frac{t\_4 \cdot \left(1.0880835262345679 \cdot 10^{-5} - \frac{t\_0 \cdot t\_1}{x \cdot x}\right)}{t\_2}\right)\right)\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-108}:\\
\;\;\;\;t\_5 \cdot \left(\left(e^{x}\right) \bmod \left(t\_3 \cdot \left(t\_3 \cdot \left(-0.003298611111111111 - t\_1\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -5.5999999999999998e-17Initial program 99.5%
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.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified100.0%
if -5.5999999999999998e-17 < x < -2.09999999999999993e-39Initial program 3.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.1%
Simplified3.1%
Taylor expanded in x around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f647.0%
Simplified7.0%
Applied egg-rr69.1%
if -2.09999999999999993e-39 < x < -1.16e-54Initial program 3.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.1%
Simplified3.1%
Taylor expanded in x around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f645.8%
Simplified5.8%
*-commutativeN/A
sqr-powN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
pow-prod-downN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr100.0%
if -1.16e-54 < x < -1.35000000000000002e-108Initial program 3.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.1%
Simplified3.1%
Taylor expanded in x around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f640.0%
Simplified0.0%
*-commutativeN/A
sqr-powN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
cube-unmultN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
Applied egg-rr61.1%
if -1.35000000000000002e-108 < x Initial program 6.5%
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.f646.5%
Simplified6.5%
Taylor expanded in x around 0
Simplified4.9%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f644.8%
Simplified4.8%
Taylor expanded in x around 0
+-lowering-+.f6424.7%
Simplified24.7%
Taylor expanded in x around inf
Simplified65.6%
Final simplification67.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (* x (* x x)))
(t_1 (+ 0.010416666666666666 (/ 0.25 (* x x))))
(t_2 (exp (- 0.0 x)))
(t_3 (/ t_1 (* x x))))
(if (<= x -5.6e-17)
(/ (fmod (exp x) 1.0) (exp x))
(if (<= x -1.16e-54)
(*
t_2
(fmod
(exp x)
(/
(*
(* (* x x) (* x t_0))
(- 1.0880835262345679e-5 (/ (* t_1 t_3) (* x x))))
(+ t_3 -0.003298611111111111))))
(if (<= x -1.35e-108)
(* t_2 (fmod (exp x) (* t_0 (* t_0 (- -0.003298611111111111 t_3)))))
(fmod x 1.0))))))
double code(double x) {
double t_0 = x * (x * x);
double t_1 = 0.010416666666666666 + (0.25 / (x * x));
double t_2 = exp((0.0 - x));
double t_3 = t_1 / (x * x);
double tmp;
if (x <= -5.6e-17) {
tmp = fmod(exp(x), 1.0) / exp(x);
} else if (x <= -1.16e-54) {
tmp = t_2 * fmod(exp(x), ((((x * x) * (x * t_0)) * (1.0880835262345679e-5 - ((t_1 * t_3) / (x * x)))) / (t_3 + -0.003298611111111111)));
} else if (x <= -1.35e-108) {
tmp = t_2 * fmod(exp(x), (t_0 * (t_0 * (-0.003298611111111111 - t_3))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = x * (x * x)
t_1 = 0.010416666666666666d0 + (0.25d0 / (x * x))
t_2 = exp((0.0d0 - x))
t_3 = t_1 / (x * x)
if (x <= (-5.6d-17)) then
tmp = mod(exp(x), 1.0d0) / exp(x)
else if (x <= (-1.16d-54)) then
tmp = t_2 * mod(exp(x), ((((x * x) * (x * t_0)) * (1.0880835262345679d-5 - ((t_1 * t_3) / (x * x)))) / (t_3 + (-0.003298611111111111d0))))
else if (x <= (-1.35d-108)) then
tmp = t_2 * mod(exp(x), (t_0 * (t_0 * ((-0.003298611111111111d0) - t_3))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = x * (x * x) t_1 = 0.010416666666666666 + (0.25 / (x * x)) t_2 = math.exp((0.0 - x)) t_3 = t_1 / (x * x) tmp = 0 if x <= -5.6e-17: tmp = math.fmod(math.exp(x), 1.0) / math.exp(x) elif x <= -1.16e-54: tmp = t_2 * math.fmod(math.exp(x), ((((x * x) * (x * t_0)) * (1.0880835262345679e-5 - ((t_1 * t_3) / (x * x)))) / (t_3 + -0.003298611111111111))) elif x <= -1.35e-108: tmp = t_2 * math.fmod(math.exp(x), (t_0 * (t_0 * (-0.003298611111111111 - t_3)))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) t_0 = Float64(x * Float64(x * x)) t_1 = Float64(0.010416666666666666 + Float64(0.25 / Float64(x * x))) t_2 = exp(Float64(0.0 - x)) t_3 = Float64(t_1 / Float64(x * x)) tmp = 0.0 if (x <= -5.6e-17) tmp = Float64(rem(exp(x), 1.0) / exp(x)); elseif (x <= -1.16e-54) tmp = Float64(t_2 * rem(exp(x), Float64(Float64(Float64(Float64(x * x) * Float64(x * t_0)) * Float64(1.0880835262345679e-5 - Float64(Float64(t_1 * t_3) / Float64(x * x)))) / Float64(t_3 + -0.003298611111111111)))); elseif (x <= -1.35e-108) tmp = Float64(t_2 * rem(exp(x), Float64(t_0 * Float64(t_0 * Float64(-0.003298611111111111 - t_3))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.010416666666666666 + N[(0.25 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e-17], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.16e-54], N[(t$95$2 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(1.0880835262345679e-5 - N[(N[(t$95$1 * t$95$3), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 + -0.003298611111111111), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e-108], N[(t$95$2 * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(t$95$0 * N[(t$95$0 * N[(-0.003298611111111111 - t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := 0.010416666666666666 + \frac{0.25}{x \cdot x}\\
t_2 := e^{0 - x}\\
t_3 := \frac{t\_1}{x \cdot x}\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -1.16 \cdot 10^{-54}:\\
\;\;\;\;t\_2 \cdot \left(\left(e^{x}\right) \bmod \left(\frac{\left(\left(x \cdot x\right) \cdot \left(x \cdot t\_0\right)\right) \cdot \left(1.0880835262345679 \cdot 10^{-5} - \frac{t\_1 \cdot t\_3}{x \cdot x}\right)}{t\_3 + -0.003298611111111111}\right)\right)\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-108}:\\
\;\;\;\;t\_2 \cdot \left(\left(e^{x}\right) \bmod \left(t\_0 \cdot \left(t\_0 \cdot \left(-0.003298611111111111 - t\_3\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -5.5999999999999998e-17Initial program 99.5%
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.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified100.0%
if -5.5999999999999998e-17 < x < -1.16e-54Initial program 3.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.1%
Simplified3.1%
Taylor expanded in x around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f646.4%
Simplified6.4%
*-commutativeN/A
sqr-powN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
pow-prod-downN/A
associate-*l/N/A
/-lowering-/.f64N/A
Applied egg-rr47.7%
if -1.16e-54 < x < -1.35000000000000002e-108Initial program 3.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.1%
Simplified3.1%
Taylor expanded in x around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f640.0%
Simplified0.0%
*-commutativeN/A
sqr-powN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
cube-unmultN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
Applied egg-rr61.1%
if -1.35000000000000002e-108 < x Initial program 6.5%
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.f646.5%
Simplified6.5%
Taylor expanded in x around 0
Simplified4.9%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f644.8%
Simplified4.8%
Taylor expanded in x around 0
+-lowering-+.f6424.7%
Simplified24.7%
Taylor expanded in x around inf
Simplified65.6%
Final simplification64.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* x (* x x))))
(if (<= x -5.6e-17)
(/ (fmod (exp x) 1.0) (exp x))
(if (<= x -1.35e-108)
(*
(exp (- 0.0 x))
(fmod
(exp x)
(*
t_0
(*
t_0
(-
-0.003298611111111111
(/ (+ 0.010416666666666666 (/ 0.25 (* x x))) (* x x)))))))
(fmod x 1.0)))))
double code(double x) {
double t_0 = x * (x * x);
double tmp;
if (x <= -5.6e-17) {
tmp = fmod(exp(x), 1.0) / exp(x);
} else if (x <= -1.35e-108) {
tmp = exp((0.0 - x)) * fmod(exp(x), (t_0 * (t_0 * (-0.003298611111111111 - ((0.010416666666666666 + (0.25 / (x * x))) / (x * x))))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * (x * x)
if (x <= (-5.6d-17)) then
tmp = mod(exp(x), 1.0d0) / exp(x)
else if (x <= (-1.35d-108)) then
tmp = exp((0.0d0 - x)) * mod(exp(x), (t_0 * (t_0 * ((-0.003298611111111111d0) - ((0.010416666666666666d0 + (0.25d0 / (x * x))) / (x * x))))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): t_0 = x * (x * x) tmp = 0 if x <= -5.6e-17: tmp = math.fmod(math.exp(x), 1.0) / math.exp(x) elif x <= -1.35e-108: tmp = math.exp((0.0 - x)) * math.fmod(math.exp(x), (t_0 * (t_0 * (-0.003298611111111111 - ((0.010416666666666666 + (0.25 / (x * x))) / (x * x)))))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) t_0 = Float64(x * Float64(x * x)) tmp = 0.0 if (x <= -5.6e-17) tmp = Float64(rem(exp(x), 1.0) / exp(x)); elseif (x <= -1.35e-108) tmp = Float64(exp(Float64(0.0 - x)) * rem(exp(x), Float64(t_0 * Float64(t_0 * Float64(-0.003298611111111111 - Float64(Float64(0.010416666666666666 + Float64(0.25 / Float64(x * x))) / Float64(x * x))))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := Block[{t$95$0 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e-17], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e-108], N[(N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision] * N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = N[(t$95$0 * N[(t$95$0 * N[(-0.003298611111111111 - N[(N[(0.010416666666666666 + N[(0.25 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $MachinePrecision], N[With[{TMP1 = x, TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}}\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-108}:\\
\;\;\;\;e^{0 - x} \cdot \left(\left(e^{x}\right) \bmod \left(t\_0 \cdot \left(t\_0 \cdot \left(-0.003298611111111111 - \frac{0.010416666666666666 + \frac{0.25}{x \cdot x}}{x \cdot x}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -5.5999999999999998e-17Initial program 99.5%
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.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified100.0%
if -5.5999999999999998e-17 < x < -1.35000000000000002e-108Initial program 3.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.1%
Simplified3.1%
Taylor expanded in x around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f642.7%
Simplified2.7%
*-commutativeN/A
sqr-powN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
cube-unmultN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
Applied egg-rr38.1%
if -1.35000000000000002e-108 < x Initial program 6.5%
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.f646.5%
Simplified6.5%
Taylor expanded in x around 0
Simplified4.9%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f644.8%
Simplified4.8%
Taylor expanded in x around 0
+-lowering-+.f6424.7%
Simplified24.7%
Taylor expanded in x around inf
Simplified65.6%
Final simplification62.3%
(FPCore (x) :precision binary64 (if (<= x -5e-310) (/ (fmod (exp x) 1.0) (exp x)) (fmod x 1.0)))
double code(double x) {
double tmp;
if (x <= -5e-310) {
tmp = fmod(exp(x), 1.0) / exp(x);
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-310)) then
tmp = mod(exp(x), 1.0d0) / exp(x)
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-310: tmp = math.fmod(math.exp(x), 1.0) / math.exp(x) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= -5e-310) tmp = Float64(rem(exp(x), 1.0) / exp(x)); else tmp = rem(x, 1.0); end return tmp end
code[x_] := If[LessEqual[x, -5e-310], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], TMP2 = 1.0}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision] / N[Exp[x], $MachinePrecision]), $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^{-310}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -4.999999999999985e-310Initial program 8.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.f648.4%
Simplified8.4%
Taylor expanded in x around 0
Simplified8.4%
if -4.999999999999985e-310 < x Initial program 8.0%
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.f648.0%
Simplified8.0%
Taylor expanded in x around 0
Simplified5.7%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f645.5%
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6434.5%
Simplified34.5%
Taylor expanded in x around inf
Simplified94.1%
(FPCore (x)
:precision binary64
(if (<= x -5e-310)
(/
(fmod (exp x) 1.0)
(+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666)))))))
(fmod x 1.0)))
double code(double x) {
double tmp;
if (x <= -5e-310) {
tmp = fmod(exp(x), 1.0) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-310)) then
tmp = mod(exp(x), 1.0d0) / (1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-310: tmp = math.fmod(math.exp(x), 1.0) / (1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= -5e-310) tmp = Float64(rem(exp(x), 1.0) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := If[LessEqual[x, -5e-310], N[(N[With[{TMP1 = N[Exp[x], $MachinePrecision], 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], 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^{-310}:\\
\;\;\;\;\frac{\left(\left(e^{x}\right) \bmod 1\right)}{1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -4.999999999999985e-310Initial program 8.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.f648.4%
Simplified8.4%
Taylor expanded in x around 0
Simplified8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f647.3%
Simplified7.3%
if -4.999999999999985e-310 < x Initial program 8.0%
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.f648.0%
Simplified8.0%
Taylor expanded in x around 0
Simplified5.7%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f645.5%
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6434.5%
Simplified34.5%
Taylor expanded in x around inf
Simplified94.1%
(FPCore (x)
:precision binary64
(if (<= x -5e-310)
(*
(fmod
(+ 1.0 (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))))
(+ 1.0 (* x (* x -0.25))))
(+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))))
(fmod x 1.0)))
double code(double x) {
double tmp;
if (x <= -5e-310) {
tmp = fmod((1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))), (1.0 + (x * (x * -0.25)))) * (1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-310)) then
tmp = mod((1.0d0 + (x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0)))))), (1.0d0 + (x * (x * (-0.25d0))))) * (1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0)))))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-310: tmp = math.fmod((1.0 + (x * (1.0 + (x * (0.5 + (x * 0.16666666666666666)))))), (1.0 + (x * (x * -0.25)))) * (1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= -5e-310) tmp = Float64(rem(Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666)))))), Float64(1.0 + Float64(x * Float64(x * -0.25)))) * Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666))))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := If[LessEqual[x, -5e-310], N[(N[With[{TMP1 = N[(1.0 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = N[(1.0 + N[(x * N[(x * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, 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], 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^{-310}:\\
\;\;\;\;\left(\left(1 + x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)\right) \bmod \left(1 + x \cdot \left(x \cdot -0.25\right)\right)\right) \cdot \left(1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -4.999999999999985e-310Initial program 8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f648.4%
Simplified8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f647.3%
Simplified7.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-*.f647.3%
Simplified7.3%
if -4.999999999999985e-310 < x Initial program 8.0%
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.f648.0%
Simplified8.0%
Taylor expanded in x around 0
Simplified5.7%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f645.5%
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6434.5%
Simplified34.5%
Taylor expanded in x around inf
Simplified94.1%
(FPCore (x)
:precision binary64
(if (<= x -5e-310)
(*
(+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666))))))
(fmod (+ 1.0 (* x (+ 1.0 (* x 0.5)))) (+ 1.0 (* x (* x -0.25)))))
(fmod x 1.0)))
double code(double x) {
double tmp;
if (x <= -5e-310) {
tmp = (1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) * fmod((1.0 + (x * (1.0 + (x * 0.5)))), (1.0 + (x * (x * -0.25))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-310)) then
tmp = (1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) * mod((1.0d0 + (x * (1.0d0 + (x * 0.5d0)))), (1.0d0 + (x * (x * (-0.25d0)))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-310: tmp = (1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) * math.fmod((1.0 + (x * (1.0 + (x * 0.5)))), (1.0 + (x * (x * -0.25)))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= -5e-310) tmp = Float64(Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) * rem(Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5)))), Float64(1.0 + Float64(x * Float64(x * -0.25))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := If[LessEqual[x, -5e-310], N[(N[(1.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[With[{TMP1 = N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], TMP2 = N[(1.0 + N[(x * N[(x * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $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^{-310}:\\
\;\;\;\;\left(1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\right) \cdot \left(\left(1 + x \cdot \left(1 + x \cdot 0.5\right)\right) \bmod \left(1 + x \cdot \left(x \cdot -0.25\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -4.999999999999985e-310Initial program 8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f648.4%
Simplified8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f647.3%
Simplified7.3%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f647.0%
Simplified7.0%
if -4.999999999999985e-310 < x Initial program 8.0%
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.f648.0%
Simplified8.0%
Taylor expanded in x around 0
Simplified5.7%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f645.5%
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6434.5%
Simplified34.5%
Taylor expanded in x around inf
Simplified94.1%
Final simplification56.7%
(FPCore (x)
:precision binary64
(if (<= x -5e-310)
(*
(+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666))))))
(fmod (+ x 1.0) (+ 1.0 (* x (* x -0.25)))))
(fmod x 1.0)))
double code(double x) {
double tmp;
if (x <= -5e-310) {
tmp = (1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) * fmod((x + 1.0), (1.0 + (x * (x * -0.25))));
} else {
tmp = fmod(x, 1.0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-5d-310)) then
tmp = (1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) * mod((x + 1.0d0), (1.0d0 + (x * (x * (-0.25d0)))))
else
tmp = mod(x, 1.0d0)
end if
code = tmp
end function
def code(x): tmp = 0 if x <= -5e-310: tmp = (1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) * math.fmod((x + 1.0), (1.0 + (x * (x * -0.25)))) else: tmp = math.fmod(x, 1.0) return tmp
function code(x) tmp = 0.0 if (x <= -5e-310) tmp = Float64(Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) * rem(Float64(x + 1.0), Float64(1.0 + Float64(x * Float64(x * -0.25))))); else tmp = rem(x, 1.0); end return tmp end
code[x_] := If[LessEqual[x, -5e-310], N[(N[(1.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[With[{TMP1 = N[(x + 1.0), $MachinePrecision], TMP2 = N[(1.0 + N[(x * N[(x * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Mod[Abs[TMP1], Abs[TMP2]] * Sign[TMP1]], $MachinePrecision]), $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^{-310}:\\
\;\;\;\;\left(1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\right) \cdot \left(\left(x + 1\right) \bmod \left(1 + x \cdot \left(x \cdot -0.25\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \bmod 1\right)\\
\end{array}
\end{array}
if x < -4.999999999999985e-310Initial program 8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f648.4%
Simplified8.4%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f647.3%
Simplified7.3%
Taylor expanded in x around 0
+-lowering-+.f646.5%
Simplified6.5%
if -4.999999999999985e-310 < x Initial program 8.0%
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.f648.0%
Simplified8.0%
Taylor expanded in x around 0
Simplified5.7%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f645.5%
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6434.5%
Simplified34.5%
Taylor expanded in x around inf
Simplified94.1%
Final simplification56.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 8.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.f648.2%
Simplified8.2%
Taylor expanded in x around 0
Simplified6.9%
Taylor expanded in x around 0
fmod-lowering-fmod.f64N/A
exp-lowering-exp.f645.5%
Simplified5.5%
Taylor expanded in x around 0
+-lowering-+.f6422.0%
Simplified22.0%
Taylor expanded in x around inf
Simplified54.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 8.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.f648.2%
Simplified8.2%
Taylor expanded in x around 0
Simplified21.7%
Taylor expanded in x around 0
Simplified21.3%
Taylor expanded in x around 0
fmod-lowering-fmod.f6421.3%
Simplified21.3%
herbie shell --seed 2024139
(FPCore (x)
:name "expfmod (used to be hard to sample)"
:precision binary64
(* (fmod (exp x) (sqrt (cos x))) (exp (- x))))