
(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 (/ (* (/ x (+ x 1.0)) (+ x y)) y)))
(if (<= x -1.95e-16)
t_0
(if (<= x 5.1e-15) (fma x (fma (/ 1.0 y) x (- x)) x) t_0))))
double code(double x, double y) {
double t_0 = ((x / (x + 1.0)) * (x + y)) / y;
double tmp;
if (x <= -1.95e-16) {
tmp = t_0;
} else if (x <= 5.1e-15) {
tmp = fma(x, fma((1.0 / y), x, -x), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(x / Float64(x + 1.0)) * Float64(x + y)) / y) tmp = 0.0 if (x <= -1.95e-16) tmp = t_0; elseif (x <= 5.1e-15) tmp = fma(x, fma(Float64(1.0 / y), x, Float64(-x)), x); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -1.95e-16], t$95$0, If[LessEqual[x, 5.1e-15], N[(x * N[(N[(1.0 / y), $MachinePrecision] * x + (-x)), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{x}{x + 1} \cdot \left(x + y\right)}{y}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{y}, x, -x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.94999999999999989e-16 or 5.1e-15 < x Initial program 78.7%
Taylor expanded in y around 0
/-lowering-/.f64N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
distribute-rgt-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Simplified99.9%
if -1.94999999999999989e-16 < x < 5.1e-15Initial 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-/.f6499.9
Simplified99.9%
sub-negN/A
clear-numN/A
associate-/r/N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6499.9
Applied egg-rr99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -400.0)
(/ x y)
(if (<= t_0 4e-8) (- x (* x x)) (if (<= t_0 2.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 <= -400.0) {
tmp = x / y;
} else if (t_0 <= 4e-8) {
tmp = x - (x * x);
} else if (t_0 <= 2.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 <= (-400.0d0)) then
tmp = x / y
else if (t_0 <= 4d-8) then
tmp = x - (x * x)
else if (t_0 <= 2.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 <= -400.0) {
tmp = x / y;
} else if (t_0 <= 4e-8) {
tmp = x - (x * x);
} else if (t_0 <= 2.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 <= -400.0: tmp = x / y elif t_0 <= 4e-8: tmp = x - (x * x) elif t_0 <= 2.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 <= -400.0) tmp = Float64(x / y); elseif (t_0 <= 4e-8) tmp = Float64(x - Float64(x * x)); elseif (t_0 <= 2.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 <= -400.0) tmp = x / y; elseif (t_0 <= 4e-8) tmp = x - (x * x); elseif (t_0 <= 2.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, -400.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 4e-8], N[(x - N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.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 -400:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-8}:\\
\;\;\;\;x - x \cdot x\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;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))) < -400 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 76.4%
Taylor expanded in x around inf
/-lowering-/.f6485.6
Simplified85.6%
if -400 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 4.0000000000000001e-8Initial 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-/.f6499.6
Simplified99.6%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6487.8
Simplified87.8%
if 4.0000000000000001e-8 < (/.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 inf
Simplified100.0%
Taylor expanded in x around 0
Simplified98.9%
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 -400.0) t_0 (if (<= t_1 4e-8) (/ x (+ x 1.0)) 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 <= -400.0) {
tmp = t_0;
} else if (t_1 <= 4e-8) {
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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
t_1 = (x * t_0) / (x + 1.0d0)
if (t_1 <= (-400.0d0)) then
tmp = t_0
else if (t_1 <= 4d-8) 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 t_1 = (x * t_0) / (x + 1.0);
double tmp;
if (t_1 <= -400.0) {
tmp = t_0;
} else if (t_1 <= 4e-8) {
tmp = x / (x + 1.0);
} 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 <= -400.0: tmp = t_0 elif t_1 <= 4e-8: tmp = x / (x + 1.0) 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 <= -400.0) tmp = t_0; elseif (t_1 <= 4e-8) 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); t_1 = (x * t_0) / (x + 1.0); tmp = 0.0; if (t_1 <= -400.0) tmp = t_0; elseif (t_1 <= 4e-8) 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]}, Block[{t$95$1 = N[(N[(x * t$95$0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -400.0], t$95$0, If[LessEqual[t$95$1, 4e-8], N[(x / N[(x + 1.0), $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 -400:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{x + 1}\\
\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))) < -400 or 4.0000000000000001e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 80.0%
Taylor expanded in x around inf
Simplified69.5%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f6489.5
Applied egg-rr89.5%
if -400 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 4.0000000000000001e-8Initial program 99.9%
Taylor expanded in x around 0
Simplified88.1%
Final simplification88.8%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ (* x t_0) (+ x 1.0)))) (if (<= t_1 -400.0) t_0 (if (<= t_1 4e-8) (- x (* x 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 <= -400.0) {
tmp = t_0;
} else if (t_1 <= 4e-8) {
tmp = x - (x * 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 <= (-400.0d0)) then
tmp = t_0
else if (t_1 <= 4d-8) then
tmp = x - (x * 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 <= -400.0) {
tmp = t_0;
} else if (t_1 <= 4e-8) {
tmp = x - (x * 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 <= -400.0: tmp = t_0 elif t_1 <= 4e-8: tmp = x - (x * 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 <= -400.0) tmp = t_0; elseif (t_1 <= 4e-8) tmp = Float64(x - Float64(x * 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 <= -400.0) tmp = t_0; elseif (t_1 <= 4e-8) tmp = x - (x * 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, -400.0], t$95$0, If[LessEqual[t$95$1, 4e-8], N[(x - N[(x * 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 -400:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-8}:\\
\;\;\;\;x - x \cdot x\\
\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))) < -400 or 4.0000000000000001e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 80.0%
Taylor expanded in x around inf
Simplified69.5%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f6489.5
Applied egg-rr89.5%
if -400 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 4.0000000000000001e-8Initial 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-/.f6499.6
Simplified99.6%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6487.8
Simplified87.8%
Final simplification88.6%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)))) (if (<= t_0 -8000000000.0) (- (* x x)) (if (<= t_0 4e-8) x 1.0))))
double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= -8000000000.0) {
tmp = -(x * x);
} else if (t_0 <= 4e-8) {
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) :: t_0
real(8) :: tmp
t_0 = (x * (1.0d0 + (x / y))) / (x + 1.0d0)
if (t_0 <= (-8000000000.0d0)) then
tmp = -(x * x)
else if (t_0 <= 4d-8) then
tmp = x
else
tmp = 1.0d0
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 <= -8000000000.0) {
tmp = -(x * x);
} else if (t_0 <= 4e-8) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = (x * (1.0 + (x / y))) / (x + 1.0) tmp = 0 if t_0 <= -8000000000.0: tmp = -(x * x) elif t_0 <= 4e-8: tmp = x else: tmp = 1.0 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 <= -8000000000.0) tmp = Float64(-Float64(x * x)); elseif (t_0 <= 4e-8) tmp = x; else tmp = 1.0; 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 <= -8000000000.0) tmp = -(x * x); elseif (t_0 <= 4e-8) tmp = x; else tmp = 1.0; 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, -8000000000.0], (-N[(x * x), $MachinePrecision]), If[LessEqual[t$95$0, 4e-8], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -8000000000:\\
\;\;\;\;-x \cdot x\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-8}:\\
\;\;\;\;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))) < -8e9Initial program 87.3%
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-/.f6432.4
Simplified32.4%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6432.8
Simplified32.8%
Taylor expanded in x around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6433.1
Simplified33.1%
if -8e9 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 4.0000000000000001e-8Initial program 99.9%
Taylor expanded in x around 0
Simplified85.6%
if 4.0000000000000001e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 75.6%
Taylor expanded in x around inf
Simplified66.5%
Taylor expanded in x around 0
Simplified27.1%
Final simplification57.0%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 4e-8) (- x (* x x)) 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 4e-8) {
tmp = x - (x * 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)) <= 4d-8) then
tmp = x - (x * 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)) <= 4e-8) {
tmp = x - (x * x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * (1.0 + (x / y))) / (x + 1.0)) <= 4e-8: tmp = x - (x * 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)) <= 4e-8) tmp = Float64(x - Float64(x * 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)) <= 4e-8) tmp = x - (x * 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], 4e-8], N[(x - N[(x * 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 4 \cdot 10^{-8}:\\
\;\;\;\;x - x \cdot 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))) < 4.0000000000000001e-8Initial program 96.6%
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-/.f6481.3
Simplified81.3%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6472.3
Simplified72.3%
if 4.0000000000000001e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 75.6%
Taylor expanded in x around inf
Simplified66.5%
Taylor expanded in x around 0
Simplified27.1%
Final simplification57.3%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= x -2e+65) t_0 (if (<= x 9e+15) (/ (* 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+65) {
tmp = t_0;
} else if (x <= 9e+15) {
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+65)) then
tmp = t_0
else if (x <= 9d+15) 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+65) {
tmp = t_0;
} else if (x <= 9e+15) {
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+65: tmp = t_0 elif x <= 9e+15: 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+65) tmp = t_0; elseif (x <= 9e+15) 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+65) tmp = t_0; elseif (x <= 9e+15) 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+65], t$95$0, If[LessEqual[x, 9e+15], 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^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+15}:\\
\;\;\;\;\frac{x \cdot t\_0}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2e65 or 9e15 < x Initial program 75.8%
Taylor expanded in x around inf
Simplified75.8%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f64100.0
Applied egg-rr100.0%
if -2e65 < x < 9e15Initial program 99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (/ x y) (+ 1.0 (/ -1.0 y)))))
(if (<= x -1.0)
t_0
(if (<= x 0.98) (fma x (fma (/ 1.0 y) x (- x)) x) t_0))))
double code(double x, double y) {
double t_0 = (x / y) + (1.0 + (-1.0 / y));
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 0.98) {
tmp = fma(x, fma((1.0 / y), x, -x), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x / y) + Float64(1.0 + Float64(-1.0 / y))) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 0.98) tmp = fma(x, fma(Float64(1.0 / y), x, Float64(-x)), x); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] + N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 0.98], N[(x * N[(N[(1.0 / y), $MachinePrecision] * x + (-x)), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} + \left(1 + \frac{-1}{y}\right)\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{y}, x, -x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 0.97999999999999998 < x Initial program 77.6%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
sub-negN/A
distribute-rgt-inN/A
*-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
associate-*l/N/A
*-lft-identityN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
associate-+l+N/A
*-commutativeN/A
distribute-lft-neg-outN/A
associate-/r*N/A
associate-*r/N/A
rgt-mult-inverseN/A
sub-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
Simplified99.8%
if -1 < x < 0.97999999999999998Initial program 99.8%
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.3
Simplified98.3%
sub-negN/A
clear-numN/A
associate-/r/N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6498.3
Applied egg-rr98.3%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 4e-8) x 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 4e-8) {
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)) <= 4d-8) 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)) <= 4e-8) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * (1.0 + (x / y))) / (x + 1.0)) <= 4e-8: 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)) <= 4e-8) 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)) <= 4e-8) 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], 4e-8], x, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1} \leq 4 \cdot 10^{-8}:\\
\;\;\;\;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))) < 4.0000000000000001e-8Initial program 96.6%
Taylor expanded in x around 0
Simplified64.0%
if 4.0000000000000001e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 75.6%
Taylor expanded in x around inf
Simplified66.5%
Taylor expanded in x around 0
Simplified27.1%
Final simplification51.7%
(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.6%
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
(if (<= x -1.0)
(+ 1.0 (/ x y))
(if (<= x 1.0)
(fma x (fma (/ 1.0 y) x (- x)) x)
(fma (/ 1.0 y) (+ x -1.0) 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 + (x / y);
} else if (x <= 1.0) {
tmp = fma(x, fma((1.0 / y), x, -x), x);
} else {
tmp = fma((1.0 / y), (x + -1.0), 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 + Float64(x / y)); elseif (x <= 1.0) tmp = fma(x, fma(Float64(1.0 / y), x, Float64(-x)), x); else tmp = fma(Float64(1.0 / y), Float64(x + -1.0), 1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(x * N[(N[(1.0 / y), $MachinePrecision] * x + (-x)), $MachinePrecision] + x), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{y}, x, -x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{y}, x + -1, 1\right)\\
\end{array}
\end{array}
if x < -1Initial program 73.6%
Taylor expanded in x around inf
Simplified73.5%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f6499.9
Applied egg-rr99.9%
if -1 < x < 1Initial program 99.8%
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.3
Simplified98.3%
sub-negN/A
clear-numN/A
associate-/r/N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6498.3
Applied egg-rr98.3%
if 1 < x Initial program 81.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-+.f6499.4
Simplified99.4%
Final simplification98.9%
(FPCore (x y) :precision binary64 (if (<= x -1.0) (+ 1.0 (/ x y)) (if (<= x 1.0) (fma x (- (/ x y) x) x) (fma (/ 1.0 y) (+ x -1.0) 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = 1.0 + (x / y);
} else if (x <= 1.0) {
tmp = fma(x, ((x / y) - x), x);
} else {
tmp = fma((1.0 / y), (x + -1.0), 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 + Float64(x / y)); elseif (x <= 1.0) tmp = fma(x, Float64(Float64(x / y) - x), x); else tmp = fma(Float64(1.0 / y), Float64(x + -1.0), 1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(x * N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y} - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{y}, x + -1, 1\right)\\
\end{array}
\end{array}
if x < -1Initial program 73.6%
Taylor expanded in x around inf
Simplified73.5%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f6499.9
Applied egg-rr99.9%
if -1 < x < 1Initial program 99.8%
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.3
Simplified98.3%
if 1 < x Initial program 81.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-+.f6499.4
Simplified99.4%
Final simplification98.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= x -1.0) t_0 (if (<= x 0.8) (fma x (- (/ x y) x) x) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 0.8) {
tmp = fma(x, ((x / y) - x), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 0.8) tmp = fma(x, Float64(Float64(x / y) - x), x); 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, -1.0], t$95$0, If[LessEqual[x, 0.8], N[(x * N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.8:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y} - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 0.80000000000000004 < x Initial program 77.6%
Taylor expanded in x around inf
Simplified76.9%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
if -1 < x < 0.80000000000000004Initial program 99.8%
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.3
Simplified98.3%
Final simplification98.7%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= x -1.0) t_0 (if (<= x 1.0) (fma x (/ x y) x) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = fma(x, (x / y), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 1.0) tmp = fma(x, Float64(x / y), x); 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, -1.0], t$95$0, If[LessEqual[x, 1.0], N[(x * N[(x / y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 77.6%
Taylor expanded in x around inf
Simplified76.9%
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
div-invN/A
/-rgt-identityN/A
+-lowering-+.f64N/A
/-lowering-/.f6499.3
Applied egg-rr99.3%
if -1 < x < 1Initial program 99.8%
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.3
Simplified98.3%
Taylor expanded in y around 0
/-lowering-/.f6497.5
Simplified97.5%
Final simplification98.3%
(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.6%
Taylor expanded in x around inf
Simplified37.7%
Taylor expanded in x around 0
Simplified11.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 2024199
(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)))