
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -7.6e+43)
t_0
(if (<= x 3.6e+15) (/ (* x (/ (+ x y) y)) (+ x 1.0)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -7.6e+43) {
tmp = t_0;
} else if (x <= 3.6e+15) {
tmp = (x * ((x + y) / y)) / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
if (x <= (-7.6d+43)) then
tmp = t_0
else if (x <= 3.6d+15) then
tmp = (x * ((x + y) / y)) / (x + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -7.6e+43) {
tmp = t_0;
} else if (x <= 3.6e+15) {
tmp = (x * ((x + y) / y)) / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -7.6e+43: tmp = t_0 elif x <= 3.6e+15: tmp = (x * ((x + y) / y)) / (x + 1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -7.6e+43) tmp = t_0; elseif (x <= 3.6e+15) tmp = Float64(Float64(x * Float64(Float64(x + y) / y)) / Float64(x + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -7.6e+43) tmp = t_0; elseif (x <= 3.6e+15) tmp = (x * ((x + y) / y)) / (x + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.6e+43], t$95$0, If[LessEqual[x, 3.6e+15], N[(N[(x * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{x \cdot \frac{x + y}{y}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.60000000000000016e43 or 3.6e15 < x Initial program 77.7%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f64100.0
Simplified100.0%
if -7.60000000000000016e43 < x < 3.6e15Initial program 99.9%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-lowering-+.f6499.9
Simplified99.9%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -100000000.0)
(/ x y)
(if (<= t_0 0.05)
(* x (- 1.0 x))
(if (<= t_0 2.0) (+ 1.0 (/ -1.0 x)) (/ x y))))))
double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -100000000.0) {
tmp = x / y;
} else if (t_0 <= 0.05) {
tmp = x * (1.0 - x);
} else if (t_0 <= 2.0) {
tmp = 1.0 + (-1.0 / x);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * (1.0d0 + (x / y))) / (x + 1.0d0)
if (t_0 <= (-100000000.0d0)) then
tmp = x / y
else if (t_0 <= 0.05d0) then
tmp = x * (1.0d0 - x)
else if (t_0 <= 2.0d0) then
tmp = 1.0d0 + ((-1.0d0) / x)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -100000000.0) {
tmp = x / y;
} else if (t_0 <= 0.05) {
tmp = x * (1.0 - x);
} else if (t_0 <= 2.0) {
tmp = 1.0 + (-1.0 / x);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = (x * (1.0 + (x / y))) / (x + 1.0) tmp = 0 if t_0 <= -100000000.0: tmp = x / y elif t_0 <= 0.05: tmp = x * (1.0 - x) elif t_0 <= 2.0: tmp = 1.0 + (-1.0 / x) else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(1.0 + Float64(x / y))) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= -100000000.0) tmp = Float64(x / y); elseif (t_0 <= 0.05) tmp = Float64(x * Float64(1.0 - x)); elseif (t_0 <= 2.0) tmp = Float64(1.0 + Float64(-1.0 / x)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * (1.0 + (x / y))) / (x + 1.0); tmp = 0.0; if (t_0 <= -100000000.0) tmp = x / y; elseif (t_0 <= 0.05) tmp = x * (1.0 - x); elseif (t_0 <= 2.0) tmp = 1.0 + (-1.0 / x); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -100000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.05], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(1.0 + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -100000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 0.05:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;1 + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e8 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 76.5%
Taylor expanded in x around inf
/-lowering-/.f6490.1
Simplified90.1%
if -1e8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.050000000000000003Initial program 99.9%
Taylor expanded in x around 0
Simplified85.8%
Taylor expanded in x around 0
lft-mult-inverseN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6485.0
Simplified85.0%
if 0.050000000000000003 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 100.0%
Taylor expanded in x around 0
Simplified97.3%
Taylor expanded in x around inf
sub-negN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6491.1
Simplified91.1%
Final simplification87.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -100000000.0)
(/ x y)
(if (<= t_0 5e-10)
(* x (- 1.0 x))
(if (<= t_0 2000000000000.0) 1.0 (/ x y))))))
double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -100000000.0) {
tmp = x / y;
} else if (t_0 <= 5e-10) {
tmp = x * (1.0 - x);
} else if (t_0 <= 2000000000000.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * (1.0d0 + (x / y))) / (x + 1.0d0)
if (t_0 <= (-100000000.0d0)) then
tmp = x / y
else if (t_0 <= 5d-10) then
tmp = x * (1.0d0 - x)
else if (t_0 <= 2000000000000.0d0) then
tmp = 1.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -100000000.0) {
tmp = x / y;
} else if (t_0 <= 5e-10) {
tmp = x * (1.0 - x);
} else if (t_0 <= 2000000000000.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = (x * (1.0 + (x / y))) / (x + 1.0) tmp = 0 if t_0 <= -100000000.0: tmp = x / y elif t_0 <= 5e-10: tmp = x * (1.0 - x) elif t_0 <= 2000000000000.0: tmp = 1.0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(1.0 + Float64(x / y))) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= -100000000.0) tmp = Float64(x / y); elseif (t_0 <= 5e-10) tmp = Float64(x * Float64(1.0 - x)); elseif (t_0 <= 2000000000000.0) tmp = 1.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * (1.0 + (x / y))) / (x + 1.0); tmp = 0.0; if (t_0 <= -100000000.0) tmp = x / y; elseif (t_0 <= 5e-10) tmp = x * (1.0 - x); elseif (t_0 <= 2000000000000.0) tmp = 1.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -100000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 5e-10], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2000000000000.0], 1.0, N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -100000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{elif}\;t\_0 \leq 2000000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e8 or 2e12 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 76.3%
Taylor expanded in x around inf
/-lowering-/.f6490.8
Simplified90.8%
if -1e8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000031e-10Initial program 99.9%
Taylor expanded in x around 0
Simplified87.2%
Taylor expanded in x around 0
lft-mult-inverseN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6486.9
Simplified86.9%
if 5.00000000000000031e-10 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2e12Initial program 99.9%
Taylor expanded in x around 0
Simplified89.6%
Taylor expanded in x around inf
Simplified80.7%
Final simplification87.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ (* x t_0) (+ x 1.0))))
(if (<= t_1 -100000000.0)
t_0
(if (<= t_1 2000000000000.0) (/ x (+ x 1.0)) (/ (+ x -1.0) y)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = (x * t_0) / (x + 1.0);
double tmp;
if (t_1 <= -100000000.0) {
tmp = t_0;
} else if (t_1 <= 2000000000000.0) {
tmp = x / (x + 1.0);
} else {
tmp = (x + -1.0) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
t_1 = (x * t_0) / (x + 1.0d0)
if (t_1 <= (-100000000.0d0)) then
tmp = t_0
else if (t_1 <= 2000000000000.0d0) then
tmp = x / (x + 1.0d0)
else
tmp = (x + (-1.0d0)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = (x * t_0) / (x + 1.0);
double tmp;
if (t_1 <= -100000000.0) {
tmp = t_0;
} else if (t_1 <= 2000000000000.0) {
tmp = x / (x + 1.0);
} else {
tmp = (x + -1.0) / y;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = (x * t_0) / (x + 1.0) tmp = 0 if t_1 <= -100000000.0: tmp = t_0 elif t_1 <= 2000000000000.0: tmp = x / (x + 1.0) else: tmp = (x + -1.0) / y return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) t_1 = Float64(Float64(x * t_0) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -100000000.0) tmp = t_0; elseif (t_1 <= 2000000000000.0) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(Float64(x + -1.0) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); t_1 = (x * t_0) / (x + 1.0); tmp = 0.0; if (t_1 <= -100000000.0) tmp = t_0; elseif (t_1 <= 2000000000000.0) tmp = x / (x + 1.0); else tmp = (x + -1.0) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * t$95$0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -100000000.0], t$95$0, If[LessEqual[t$95$1, 2000000000000.0], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := \frac{x \cdot t\_0}{x + 1}\\
\mathbf{if}\;t\_1 \leq -100000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2000000000000:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + -1}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e8Initial program 79.7%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6486.7
Simplified86.7%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6487.0
Applied egg-rr87.0%
Taylor expanded in x around inf
/-lowering-/.f6486.9
Simplified86.9%
if -1e8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2e12Initial program 99.9%
Taylor expanded in x around 0
Simplified87.8%
if 2e12 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 72.4%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6497.2
Simplified97.2%
Taylor expanded in y around 0
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6497.3
Simplified97.3%
Final simplification89.5%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ (* x t_0) (+ x 1.0)))) (if (<= t_1 -100000000.0) t_0 (if (<= t_1 0.05) (* x (- 1.0 x)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = (x * t_0) / (x + 1.0);
double tmp;
if (t_1 <= -100000000.0) {
tmp = t_0;
} else if (t_1 <= 0.05) {
tmp = x * (1.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
t_1 = (x * t_0) / (x + 1.0d0)
if (t_1 <= (-100000000.0d0)) then
tmp = t_0
else if (t_1 <= 0.05d0) then
tmp = x * (1.0d0 - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = (x * t_0) / (x + 1.0);
double tmp;
if (t_1 <= -100000000.0) {
tmp = t_0;
} else if (t_1 <= 0.05) {
tmp = x * (1.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = (x * t_0) / (x + 1.0) tmp = 0 if t_1 <= -100000000.0: tmp = t_0 elif t_1 <= 0.05: tmp = x * (1.0 - x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) t_1 = Float64(Float64(x * t_0) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -100000000.0) tmp = t_0; elseif (t_1 <= 0.05) tmp = Float64(x * Float64(1.0 - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); t_1 = (x * t_0) / (x + 1.0); tmp = 0.0; if (t_1 <= -100000000.0) tmp = t_0; elseif (t_1 <= 0.05) tmp = x * (1.0 - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * t$95$0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -100000000.0], t$95$0, If[LessEqual[t$95$1, 0.05], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := \frac{x \cdot t\_0}{x + 1}\\
\mathbf{if}\;t\_1 \leq -100000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.05:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e8 or 0.050000000000000003 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 81.8%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6491.0
Simplified91.0%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6491.2
Applied egg-rr91.2%
Taylor expanded in x around inf
/-lowering-/.f6490.9
Simplified90.9%
if -1e8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.050000000000000003Initial program 99.9%
Taylor expanded in x around 0
Simplified85.8%
Taylor expanded in x around 0
lft-mult-inverseN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6485.0
Simplified85.0%
Final simplification88.3%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 5e-10) (* x (- 1.0 x)) 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10) {
tmp = x * (1.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((x * (1.0d0 + (x / y))) / (x + 1.0d0)) <= 5d-10) then
tmp = x * (1.0d0 - x)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10) {
tmp = x * (1.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10: tmp = x * (1.0 - x) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(x * Float64(1.0 + Float64(x / y))) / Float64(x + 1.0)) <= 5e-10) tmp = Float64(x * Float64(1.0 - x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10) tmp = x * (1.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(x * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 5e-10], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000031e-10Initial program 92.9%
Taylor expanded in x around 0
Simplified57.1%
Taylor expanded in x around 0
lft-mult-inverseN/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6466.0
Simplified66.0%
if 5.00000000000000031e-10 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 83.8%
Taylor expanded in x around 0
Simplified39.6%
Taylor expanded in x around inf
Simplified35.9%
Final simplification55.8%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= x -2e+49) t_0 (if (<= x 1e+16) (/ (* x t_0) (+ x 1.0)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -2e+49) {
tmp = t_0;
} else if (x <= 1e+16) {
tmp = (x * t_0) / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
if (x <= (-2d+49)) then
tmp = t_0
else if (x <= 1d+16) then
tmp = (x * t_0) / (x + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -2e+49) {
tmp = t_0;
} else if (x <= 1e+16) {
tmp = (x * t_0) / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -2e+49: tmp = t_0 elif x <= 1e+16: tmp = (x * t_0) / (x + 1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -2e+49) tmp = t_0; elseif (x <= 1e+16) tmp = Float64(Float64(x * t_0) / Float64(x + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -2e+49) tmp = t_0; elseif (x <= 1e+16) tmp = (x * t_0) / (x + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+49], t$95$0, If[LessEqual[x, 1e+16], N[(N[(x * t$95$0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -2 \cdot 10^{+49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 10^{+16}:\\
\;\;\;\;\frac{x \cdot t\_0}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.99999999999999989e49 or 1e16 < x Initial program 77.7%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f64100.0
Simplified100.0%
if -1.99999999999999989e49 < x < 1e16Initial program 99.9%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 5e-10) x 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((x * (1.0d0 + (x / y))) / (x + 1.0d0)) <= 5d-10) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(x * Float64(1.0 + Float64(x / y))) / Float64(x + 1.0)) <= 5e-10) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 5e-10) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(x * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 5e-10], x, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000031e-10Initial program 92.9%
Taylor expanded in x around 0
Simplified57.1%
if 5.00000000000000031e-10 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 83.8%
Taylor expanded in x around 0
Simplified39.6%
Taylor expanded in x around inf
Simplified35.9%
Final simplification49.9%
(FPCore (x y) :precision binary64 (/ x (/ (+ x 1.0) (+ 1.0 (/ x y)))))
double code(double x, double y) {
return x / ((x + 1.0) / (1.0 + (x / y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / ((x + 1.0d0) / (1.0d0 + (x / y)))
end function
public static double code(double x, double y) {
return x / ((x + 1.0) / (1.0 + (x / y)));
}
def code(x, y): return x / ((x + 1.0) / (1.0 + (x / y)))
function code(x, y) return Float64(x / Float64(Float64(x + 1.0) / Float64(1.0 + Float64(x / y)))) end
function tmp = code(x, y) tmp = x / ((x + 1.0) / (1.0 + (x / y))); end
code[x_, y_] := N[(x / N[(N[(x + 1.0), $MachinePrecision] / N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{x + 1}{1 + \frac{x}{y}}}
\end{array}
Initial program 89.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6499.9
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -4e+17)
t_0
(if (<= x 1.2e+15) (* x (/ (+ x y) (fma x y y))) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -4e+17) {
tmp = t_0;
} else if (x <= 1.2e+15) {
tmp = x * ((x + y) / fma(x, y, y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -4e+17) tmp = t_0; elseif (x <= 1.2e+15) tmp = Float64(x * Float64(Float64(x + y) / fma(x, y, y))); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e+17], t$95$0, If[LessEqual[x, 1.2e+15], N[(x * N[(N[(x + y), $MachinePrecision] / N[(x * y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -4 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \frac{x + y}{\mathsf{fma}\left(x, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4e17 or 1.2e15 < x Initial program 79.3%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f64100.0
Simplified100.0%
if -4e17 < x < 1.2e15Initial program 99.9%
Taylor expanded in y around 0
/-lowering-/.f64N/A
+-lowering-+.f6499.9
Simplified99.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-rgt-identityN/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
remove-double-negN/A
un-div-invN/A
clear-numN/A
/-rgt-identityN/A
distribute-lft-inN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6499.9
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= x -1.0) (+ 1.0 (/ (+ x -1.0) y)) (if (<= x 0.8) (fma x (- (/ x y) x) x) (+ 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 0.8) {
tmp = fma(x, ((x / y) - x), x);
} else {
tmp = 1.0 + (x / y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); elseif (x <= 0.8) tmp = fma(x, Float64(Float64(x / y) - x), x); else tmp = Float64(1.0 + Float64(x / y)); end return tmp end
code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.8], N[(x * N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision] + x), $MachinePrecision], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 0.8:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y} - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 85.5%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6495.0
Simplified95.0%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6495.1
Applied egg-rr95.1%
if -1 < x < 0.80000000000000004Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
distribute-rgt-out--N/A
associate-*l/N/A
*-lft-identityN/A
*-lft-identityN/A
--lowering--.f64N/A
/-lowering-/.f6498.5
Simplified98.5%
if 0.80000000000000004 < x Initial program 74.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f64100.0
Simplified100.0%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (<= x -1.0) (+ 1.0 (/ (+ x -1.0) y)) (if (<= x 1.0) (fma x (/ x y) x) (+ 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 1.0) {
tmp = fma(x, (x / y), x);
} else {
tmp = 1.0 + (x / y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); elseif (x <= 1.0) tmp = fma(x, Float64(x / y), x); else tmp = Float64(1.0 + Float64(x / y)); end return tmp end
code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(x * N[(x / y), $MachinePrecision] + x), $MachinePrecision], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y}\\
\end{array}
\end{array}
if x < -1Initial program 85.5%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6495.0
Simplified95.0%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6495.1
Applied egg-rr95.1%
if -1 < x < 1Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
distribute-rgt-out--N/A
associate-*l/N/A
*-lft-identityN/A
*-lft-identityN/A
--lowering--.f64N/A
/-lowering-/.f6498.5
Simplified98.5%
Taylor expanded in y around 0
/-lowering-/.f6497.4
Simplified97.4%
if 1 < x Initial program 74.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f64100.0
Simplified100.0%
Final simplification97.3%
(FPCore (x y) :precision binary64 (if (<= x -3100.0) (+ 1.0 (/ (+ x -1.0) y)) (if (<= x 48000000.0) (/ x (+ x 1.0)) (+ 1.0 (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -3100.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 48000000.0) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0 + (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3100.0d0)) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else if (x <= 48000000.0d0) then
tmp = x / (x + 1.0d0)
else
tmp = 1.0d0 + (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3100.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 48000000.0) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0 + (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3100.0: tmp = 1.0 + ((x + -1.0) / y) elif x <= 48000000.0: tmp = x / (x + 1.0) else: tmp = 1.0 + (x / y) return tmp
function code(x, y) tmp = 0.0 if (x <= -3100.0) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); elseif (x <= 48000000.0) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3100.0) tmp = 1.0 + ((x + -1.0) / y); elseif (x <= 48000000.0) tmp = x / (x + 1.0); else tmp = 1.0 + (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3100.0], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 48000000.0], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3100:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 48000000:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y}\\
\end{array}
\end{array}
if x < -3100Initial program 84.7%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6498.6
Simplified98.6%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6498.7
Applied egg-rr98.7%
if -3100 < x < 4.8e7Initial program 99.9%
Taylor expanded in x around 0
Simplified79.5%
if 4.8e7 < x Initial program 74.1%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f64100.0
Simplified100.0%
Final simplification89.6%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= x -5800000.0) t_0 (if (<= x 980000.0) (/ x (+ x 1.0)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -5800000.0) {
tmp = t_0;
} else if (x <= 980000.0) {
tmp = x / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
if (x <= (-5800000.0d0)) then
tmp = t_0
else if (x <= 980000.0d0) then
tmp = x / (x + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -5800000.0) {
tmp = t_0;
} else if (x <= 980000.0) {
tmp = x / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -5800000.0: tmp = t_0 elif x <= 980000.0: tmp = x / (x + 1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -5800000.0) tmp = t_0; elseif (x <= 980000.0) tmp = Float64(x / Float64(x + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -5800000.0) tmp = t_0; elseif (x <= 980000.0) tmp = x / (x + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5800000.0], t$95$0, If[LessEqual[x, 980000.0], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -5800000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 980000:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.8e6 or 9.8e5 < x Initial program 79.6%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-lft-inN/A
sub-negN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
neg-mul-1N/A
distribute-rgt-outN/A
rgt-mult-inverseN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.8
Simplified99.8%
+-lowering-+.f64N/A
*-commutativeN/A
un-div-invN/A
metadata-evalN/A
sub-negN/A
/-lowering-/.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
/-lowering-/.f6499.7
Simplified99.7%
if -5.8e6 < x < 9.8e5Initial program 99.9%
Taylor expanded in x around 0
Simplified79.1%
Final simplification89.4%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 89.8%
Taylor expanded in x around 0
Simplified51.2%
Taylor expanded in x around inf
Simplified14.0%
(FPCore (x y) :precision binary64 (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0))))
double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / 1.0d0) * (((x / y) + 1.0d0) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
def code(x, y): return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0))
function code(x, y) return Float64(Float64(x / 1.0) * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = (x / 1.0) * (((x / y) + 1.0) / (x + 1.0)); end
code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
herbie shell --seed 2024195
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:alt
(! :herbie-platform default (* (/ x 1) (/ (+ (/ x y) 1) (+ x 1))))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))