
(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 16 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 (* (/ 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(Float64(x / 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[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + 1} \cdot \left(1 + \frac{x}{y}\right)
\end{array}
Initial program 88.2%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/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 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -100000000000.0)
(/ x y)
(if (<= t_0 0.8)
(* x (fma x (+ x -1.0) 1.0))
(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 <= -100000000000.0) {
tmp = x / y;
} else if (t_0 <= 0.8) {
tmp = x * fma(x, (x + -1.0), 1.0);
} else if (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 <= -100000000000.0) tmp = Float64(x / y); elseif (t_0 <= 0.8) tmp = Float64(x * fma(x, Float64(x + -1.0), 1.0)); elseif (t_0 <= 2.0) tmp = Float64(1.0 + Float64(-1.0 / x)); else tmp = Float64(x / y); end return 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, -100000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.8], N[(x * N[(x * N[(x + -1.0), $MachinePrecision] + 1.0), $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 -100000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 0.8:\\
\;\;\;\;x \cdot \mathsf{fma}\left(x, x + -1, 1\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))) < -1e11 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 74.6%
Taylor expanded in x around inf
/-lowering-/.f6481.4
Simplified81.4%
if -1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.80000000000000004Initial program 100.0%
Taylor expanded in x around 0
Simplified86.4%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6485.3
Simplified85.3%
if 0.80000000000000004 < (/.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
Simplified98.0%
Taylor expanded in x around inf
sub-negN/A
+-lowering-+.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6498.0
Simplified98.0%
Final simplification85.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -100000000000.0)
(/ x y)
(if (<= t_0 0.02)
(* x (fma x (+ x -1.0) 1.0))
(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 <= -100000000000.0) {
tmp = x / y;
} else if (t_0 <= 0.02) {
tmp = x * fma(x, (x + -1.0), 1.0);
} else if (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 <= -100000000000.0) tmp = Float64(x / y); elseif (t_0 <= 0.02) tmp = Float64(x * fma(x, Float64(x + -1.0), 1.0)); elseif (t_0 <= 2.0) tmp = 1.0; else tmp = Float64(x / y); end return 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, -100000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.02], N[(x * N[(x * N[(x + -1.0), $MachinePrecision] + 1.0), $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 -100000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;x \cdot \mathsf{fma}\left(x, x + -1, 1\right)\\
\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))) < -1e11 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 74.6%
Taylor expanded in x around inf
/-lowering-/.f6481.4
Simplified81.4%
if -1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.0200000000000000004Initial program 100.0%
Taylor expanded in x around 0
Simplified87.9%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6486.7
Simplified86.7%
if 0.0200000000000000004 < (/.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
Simplified93.0%
Taylor expanded in x around inf
Simplified90.8%
Final simplification84.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 -100000000000.0)
(/ x y)
(if (<= t_0 0.02) (fma x (- 0.0 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 <= -100000000000.0) {
tmp = x / y;
} else if (t_0 <= 0.02) {
tmp = fma(x, (0.0 - x), x);
} else if (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 <= -100000000000.0) tmp = Float64(x / y); elseif (t_0 <= 0.02) tmp = fma(x, Float64(0.0 - x), x); elseif (t_0 <= 2.0) tmp = 1.0; else tmp = Float64(x / y); end return 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, -100000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.02], N[(x * N[(0.0 - x), $MachinePrecision] + x), $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 -100000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\mathsf{fma}\left(x, 0 - x, x\right)\\
\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))) < -1e11 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 74.6%
Taylor expanded in x around inf
/-lowering-/.f6481.4
Simplified81.4%
if -1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.0200000000000000004Initial program 100.0%
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.4
Simplified98.4%
Taylor expanded in y around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6486.3
Simplified86.3%
if 0.0200000000000000004 < (/.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
Simplified93.0%
Taylor expanded in x around inf
Simplified90.8%
Final simplification84.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ (* x t_0) (+ x 1.0))))
(if (<= t_1 -100000000000.0)
t_0
(if (<= t_1 1.000000000000002) (/ 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 <= -100000000000.0) {
tmp = t_0;
} else if (t_1 <= 1.000000000000002) {
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 <= (-100000000000.0d0)) then
tmp = t_0
else if (t_1 <= 1.000000000000002d0) 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 <= -100000000000.0) {
tmp = t_0;
} else if (t_1 <= 1.000000000000002) {
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 <= -100000000000.0: tmp = t_0 elif t_1 <= 1.000000000000002: 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 <= -100000000000.0) tmp = t_0; elseif (t_1 <= 1.000000000000002) 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 <= -100000000000.0) tmp = t_0; elseif (t_1 <= 1.000000000000002) 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, -100000000000.0], t$95$0, If[LessEqual[t$95$1, 1.000000000000002], 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 -100000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 1.000000000000002:\\
\;\;\;\;\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))) < -1e11 or 1.000000000000002 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 75.3%
Taylor expanded in x around inf
Simplified60.2%
Taylor expanded in x around 0
+-lowering-+.f64N/A
/-lowering-/.f6484.8
Simplified84.8%
if -1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1.000000000000002Initial program 100.0%
Taylor expanded in x around 0
Simplified89.4%
Final simplification87.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ (* x t_0) (+ x 1.0))))
(if (<= t_1 -100000000000.0)
t_0
(if (<= t_1 0.8) (* x (fma x (+ x -1.0) 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 <= -100000000000.0) {
tmp = t_0;
} else if (t_1 <= 0.8) {
tmp = x * fma(x, (x + -1.0), 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 <= -100000000000.0) tmp = t_0; elseif (t_1 <= 0.8) tmp = Float64(x * fma(x, Float64(x + -1.0), 1.0)); else tmp = t_0; end return 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, -100000000000.0], t$95$0, If[LessEqual[t$95$1, 0.8], N[(x * N[(x * N[(x + -1.0), $MachinePrecision] + 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 -100000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 0.8:\\
\;\;\;\;x \cdot \mathsf{fma}\left(x, x + -1, 1\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))) < -1e11 or 0.80000000000000004 < (/.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
Simplified67.3%
Taylor expanded in x around 0
+-lowering-+.f64N/A
/-lowering-/.f6487.2
Simplified87.2%
if -1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.80000000000000004Initial program 100.0%
Taylor expanded in x around 0
Simplified86.4%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6485.3
Simplified85.3%
Final simplification86.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0))))
(if (<= t_0 0.02)
(fma x (- 0.0 x) x)
(if (<= t_0 2e+242) 1.0 (* x (* x x))))))
double code(double x, double y) {
double t_0 = (x * (1.0 + (x / y))) / (x + 1.0);
double tmp;
if (t_0 <= 0.02) {
tmp = fma(x, (0.0 - x), x);
} else if (t_0 <= 2e+242) {
tmp = 1.0;
} else {
tmp = x * (x * x);
}
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 <= 0.02) tmp = fma(x, Float64(0.0 - x), x); elseif (t_0 <= 2e+242) tmp = 1.0; else tmp = Float64(x * Float64(x * x)); end return 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, 0.02], N[(x * N[(0.0 - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$0, 2e+242], 1.0, N[(x * N[(x * x), $MachinePrecision]), $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 0.02:\\
\;\;\;\;\mathsf{fma}\left(x, 0 - x, x\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+242}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.0200000000000000004Initial program 88.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-/.f6471.6
Simplified71.6%
Taylor expanded in y around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6464.4
Simplified64.4%
if 0.0200000000000000004 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.0000000000000001e242Initial program 99.8%
Taylor expanded in x around 0
Simplified49.3%
Taylor expanded in x around inf
Simplified48.5%
if 2.0000000000000001e242 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 63.5%
Taylor expanded in x around 0
Simplified3.6%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6417.1
Simplified17.1%
Taylor expanded in x around inf
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6417.1
Simplified17.1%
+-rgt-identityN/A
*-lowering-*.f6417.1
Applied egg-rr17.1%
Final simplification54.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)))) (if (<= t_0 -100000000000.0) (- 0.0 (* x x)) (if (<= t_0 0.02) 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 <= -100000000000.0) {
tmp = 0.0 - (x * x);
} else if (t_0 <= 0.02) {
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 <= (-100000000000.0d0)) then
tmp = 0.0d0 - (x * x)
else if (t_0 <= 0.02d0) 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 <= -100000000000.0) {
tmp = 0.0 - (x * x);
} else if (t_0 <= 0.02) {
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 <= -100000000000.0: tmp = 0.0 - (x * x) elif t_0 <= 0.02: 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 <= -100000000000.0) tmp = Float64(0.0 - Float64(x * x)); elseif (t_0 <= 0.02) 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 <= -100000000000.0) tmp = 0.0 - (x * x); elseif (t_0 <= 0.02) 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, -100000000000.0], N[(0.0 - N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.02], 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 -100000000000:\\
\;\;\;\;0 - x \cdot x\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;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))) < -1e11Initial program 64.7%
Taylor expanded in x around 0
Simplified1.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--.f6420.1
Simplified20.1%
Taylor expanded in x around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6420.3
Simplified20.3%
if -1e11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.0200000000000000004Initial program 100.0%
Taylor expanded in x around 0
Simplified85.3%
if 0.0200000000000000004 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.1%
Taylor expanded in x around 0
Simplified34.5%
Taylor expanded in x around inf
Simplified34.0%
Final simplification51.9%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 0.02) (fma x (- 0.0 x) x) 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 0.02) {
tmp = fma(x, (0.0 - 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)) <= 0.02) tmp = fma(x, Float64(0.0 - x), x); else tmp = 1.0; end return 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], 0.02], N[(x * N[(0.0 - x), $MachinePrecision] + x), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1} \leq 0.02:\\
\;\;\;\;\mathsf{fma}\left(x, 0 - x, 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))) < 0.0200000000000000004Initial program 88.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-/.f6471.6
Simplified71.6%
Taylor expanded in y around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6464.4
Simplified64.4%
if 0.0200000000000000004 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.1%
Taylor expanded in x around 0
Simplified34.5%
Taylor expanded in x around inf
Simplified34.0%
Final simplification52.3%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 0.02) (* x (- 1.0 x)) 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 0.02) {
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)) <= 0.02d0) 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)) <= 0.02) {
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)) <= 0.02: 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)) <= 0.02) 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)) <= 0.02) 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], 0.02], 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 0.02:\\
\;\;\;\;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))) < 0.0200000000000000004Initial program 88.3%
Taylor expanded in x around 0
Simplified59.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--.f6464.4
Simplified64.4%
if 0.0200000000000000004 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.1%
Taylor expanded in x around 0
Simplified34.5%
Taylor expanded in x around inf
Simplified34.0%
Final simplification52.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -5e+21)
t_0
(if (<= x 2e+14) (/ (fma (/ x y) x x) (+ x 1.0)) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -5e+21) {
tmp = t_0;
} else if (x <= 2e+14) {
tmp = fma((x / y), x, 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 <= -5e+21) tmp = t_0; elseif (x <= 2e+14) tmp = Float64(fma(Float64(x / y), x, x) / Float64(x + 1.0)); 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, -5e+21], t$95$0, If[LessEqual[x, 2e+14], N[(N[(N[(x / y), $MachinePrecision] * x + x), $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 -5 \cdot 10^{+21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5e21 or 2e14 < x Initial program 75.6%
Taylor expanded in x around inf
Simplified75.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
/-lowering-/.f64100.0
Simplified100.0%
if -5e21 < x < 2e14Initial program 99.8%
*-commutativeN/A
distribute-lft1-inN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6499.8
Applied egg-rr99.8%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ 1.0 (/ x y))) (+ x 1.0)) 0.02) x 1.0))
double code(double x, double y) {
double tmp;
if (((x * (1.0 + (x / y))) / (x + 1.0)) <= 0.02) {
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)) <= 0.02d0) 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)) <= 0.02) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * (1.0 + (x / y))) / (x + 1.0)) <= 0.02: 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)) <= 0.02) 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)) <= 0.02) 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], 0.02], x, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(1 + \frac{x}{y}\right)}{x + 1} \leq 0.02:\\
\;\;\;\;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))) < 0.0200000000000000004Initial program 88.3%
Taylor expanded in x around 0
Simplified58.4%
if 0.0200000000000000004 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.1%
Taylor expanded in x around 0
Simplified34.5%
Taylor expanded in x around inf
Simplified34.0%
Final simplification48.7%
(FPCore (x y) :precision binary64 (let* ((t_0 (fma (/ 1.0 y) (+ x -1.0) 1.0))) (if (<= x -1.0) t_0 (if (<= x 1.0) (fma x (- (/ x y) x) x) t_0))))
double code(double x, double y) {
double t_0 = fma((1.0 / y), (x + -1.0), 1.0);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = fma(x, ((x / y) - x), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = fma(Float64(1.0 / y), Float64(x + -1.0), 1.0) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 1.0) 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[(N[(1.0 / y), $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 1.0], N[(x * N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{1}{y}, x + -1, 1\right)\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y} - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 77.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-+.f6498.6
Simplified98.6%
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-/.f6497.4
Simplified97.4%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= x -1.0) t_0 (if (<= x 0.82) (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.82) {
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.82) 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.82], 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.82:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{x}{y} - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 0.819999999999999951 < x Initial program 77.4%
Taylor expanded in x around inf
Simplified75.5%
Taylor expanded in x around 0
+-lowering-+.f64N/A
/-lowering-/.f6498.1
Simplified98.1%
if -1 < x < 0.819999999999999951Initial 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-/.f6497.4
Simplified97.4%
(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.4%
Taylor expanded in x around inf
Simplified75.5%
Taylor expanded in x around 0
+-lowering-+.f64N/A
/-lowering-/.f6498.1
Simplified98.1%
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-/.f6497.4
Simplified97.4%
Taylor expanded in y around 0
/-lowering-/.f6496.5
Simplified96.5%
(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 88.2%
Taylor expanded in x around 0
Simplified49.3%
Taylor expanded in x around inf
Simplified15.4%
(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 2024196
(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)))