
(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 12 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(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 88.0%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -4.9e+101)
(/ x y)
(if (<= x -1.32e+48)
1.0
(if (<= x -8.5e+26)
(/ x y)
(if (<= x 1.3e-66)
t_0
(if (<= x 3.6e-12)
(* x (/ x y))
(if (<= x 1.7e+121) t_0 (/ x y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.9e+101) {
tmp = x / y;
} else if (x <= -1.32e+48) {
tmp = 1.0;
} else if (x <= -8.5e+26) {
tmp = x / y;
} else if (x <= 1.3e-66) {
tmp = t_0;
} else if (x <= 3.6e-12) {
tmp = x * (x / y);
} else if (x <= 1.7e+121) {
tmp = t_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 / (x + 1.0d0)
if (x <= (-4.9d+101)) then
tmp = x / y
else if (x <= (-1.32d+48)) then
tmp = 1.0d0
else if (x <= (-8.5d+26)) then
tmp = x / y
else if (x <= 1.3d-66) then
tmp = t_0
else if (x <= 3.6d-12) then
tmp = x * (x / y)
else if (x <= 1.7d+121) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.9e+101) {
tmp = x / y;
} else if (x <= -1.32e+48) {
tmp = 1.0;
} else if (x <= -8.5e+26) {
tmp = x / y;
} else if (x <= 1.3e-66) {
tmp = t_0;
} else if (x <= 3.6e-12) {
tmp = x * (x / y);
} else if (x <= 1.7e+121) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -4.9e+101: tmp = x / y elif x <= -1.32e+48: tmp = 1.0 elif x <= -8.5e+26: tmp = x / y elif x <= 1.3e-66: tmp = t_0 elif x <= 3.6e-12: tmp = x * (x / y) elif x <= 1.7e+121: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -4.9e+101) tmp = Float64(x / y); elseif (x <= -1.32e+48) tmp = 1.0; elseif (x <= -8.5e+26) tmp = Float64(x / y); elseif (x <= 1.3e-66) tmp = t_0; elseif (x <= 3.6e-12) tmp = Float64(x * Float64(x / y)); elseif (x <= 1.7e+121) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -4.9e+101) tmp = x / y; elseif (x <= -1.32e+48) tmp = 1.0; elseif (x <= -8.5e+26) tmp = x / y; elseif (x <= 1.3e-66) tmp = t_0; elseif (x <= 3.6e-12) tmp = x * (x / y); elseif (x <= 1.7e+121) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.9e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.32e+48], 1.0, If[LessEqual[x, -8.5e+26], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.3e-66], t$95$0, If[LessEqual[x, 3.6e-12], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.7e+121], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.32 \cdot 10^{+48}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.89999999999999983e101 or -1.32e48 < x < -8.5e26 or 1.70000000000000005e121 < x Initial program 69.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 87.2%
if -4.89999999999999983e101 < x < -1.32e48Initial program 100.0%
div-inv99.8%
*-commutative99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in x around inf 79.1%
if -8.5e26 < x < 1.2999999999999999e-66 or 3.6e-12 < x < 1.70000000000000005e121Initial program 98.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 73.4%
if 1.2999999999999999e-66 < x < 3.6e-12Initial program 99.4%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 78.7%
Taylor expanded in x around 0 78.4%
associate-/r/78.2%
Applied egg-rr78.2%
Final simplification78.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -5e+101)
(/ x y)
(if (<= x -1.2e+47)
1.0
(if (<= x -3e+28)
(/ x y)
(if (<= x 1.3e-66)
t_0
(if (<= x 9.5e-16)
(/ x (/ y x))
(if (<= x 1.65e+121) t_0 (/ x y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -5e+101) {
tmp = x / y;
} else if (x <= -1.2e+47) {
tmp = 1.0;
} else if (x <= -3e+28) {
tmp = x / y;
} else if (x <= 1.3e-66) {
tmp = t_0;
} else if (x <= 9.5e-16) {
tmp = x / (y / x);
} else if (x <= 1.65e+121) {
tmp = t_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 / (x + 1.0d0)
if (x <= (-5d+101)) then
tmp = x / y
else if (x <= (-1.2d+47)) then
tmp = 1.0d0
else if (x <= (-3d+28)) then
tmp = x / y
else if (x <= 1.3d-66) then
tmp = t_0
else if (x <= 9.5d-16) then
tmp = x / (y / x)
else if (x <= 1.65d+121) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -5e+101) {
tmp = x / y;
} else if (x <= -1.2e+47) {
tmp = 1.0;
} else if (x <= -3e+28) {
tmp = x / y;
} else if (x <= 1.3e-66) {
tmp = t_0;
} else if (x <= 9.5e-16) {
tmp = x / (y / x);
} else if (x <= 1.65e+121) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -5e+101: tmp = x / y elif x <= -1.2e+47: tmp = 1.0 elif x <= -3e+28: tmp = x / y elif x <= 1.3e-66: tmp = t_0 elif x <= 9.5e-16: tmp = x / (y / x) elif x <= 1.65e+121: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -5e+101) tmp = Float64(x / y); elseif (x <= -1.2e+47) tmp = 1.0; elseif (x <= -3e+28) tmp = Float64(x / y); elseif (x <= 1.3e-66) tmp = t_0; elseif (x <= 9.5e-16) tmp = Float64(x / Float64(y / x)); elseif (x <= 1.65e+121) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -5e+101) tmp = x / y; elseif (x <= -1.2e+47) tmp = 1.0; elseif (x <= -3e+28) tmp = x / y; elseif (x <= 1.3e-66) tmp = t_0; elseif (x <= 9.5e-16) tmp = x / (y / x); elseif (x <= 1.65e+121) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.2e+47], 1.0, If[LessEqual[x, -3e+28], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.3e-66], t$95$0, If[LessEqual[x, 9.5e-16], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+121], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -5 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{+47}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -3 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-16}:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.99999999999999989e101 or -1.20000000000000009e47 < x < -3.0000000000000001e28 or 1.6499999999999999e121 < x Initial program 69.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 87.2%
if -4.99999999999999989e101 < x < -1.20000000000000009e47Initial program 100.0%
div-inv99.8%
*-commutative99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in x around inf 79.1%
if -3.0000000000000001e28 < x < 1.2999999999999999e-66 or 9.5000000000000005e-16 < x < 1.6499999999999999e121Initial program 98.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 73.4%
if 1.2999999999999999e-66 < x < 9.5000000000000005e-16Initial program 99.4%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 78.7%
Taylor expanded in x around 0 78.4%
Final simplification78.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -4.8e+101)
(/ x y)
(if (<= x -1.25e+47)
1.0
(if (<= x -3.6e+28)
(/ x y)
(if (<= x 1.3e-66)
t_0
(if (<= x 7e-16)
(/ (* x x) y)
(if (<= x 6.5e+121) t_0 (/ x y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.8e+101) {
tmp = x / y;
} else if (x <= -1.25e+47) {
tmp = 1.0;
} else if (x <= -3.6e+28) {
tmp = x / y;
} else if (x <= 1.3e-66) {
tmp = t_0;
} else if (x <= 7e-16) {
tmp = (x * x) / y;
} else if (x <= 6.5e+121) {
tmp = t_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 / (x + 1.0d0)
if (x <= (-4.8d+101)) then
tmp = x / y
else if (x <= (-1.25d+47)) then
tmp = 1.0d0
else if (x <= (-3.6d+28)) then
tmp = x / y
else if (x <= 1.3d-66) then
tmp = t_0
else if (x <= 7d-16) then
tmp = (x * x) / y
else if (x <= 6.5d+121) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.8e+101) {
tmp = x / y;
} else if (x <= -1.25e+47) {
tmp = 1.0;
} else if (x <= -3.6e+28) {
tmp = x / y;
} else if (x <= 1.3e-66) {
tmp = t_0;
} else if (x <= 7e-16) {
tmp = (x * x) / y;
} else if (x <= 6.5e+121) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -4.8e+101: tmp = x / y elif x <= -1.25e+47: tmp = 1.0 elif x <= -3.6e+28: tmp = x / y elif x <= 1.3e-66: tmp = t_0 elif x <= 7e-16: tmp = (x * x) / y elif x <= 6.5e+121: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -4.8e+101) tmp = Float64(x / y); elseif (x <= -1.25e+47) tmp = 1.0; elseif (x <= -3.6e+28) tmp = Float64(x / y); elseif (x <= 1.3e-66) tmp = t_0; elseif (x <= 7e-16) tmp = Float64(Float64(x * x) / y); elseif (x <= 6.5e+121) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -4.8e+101) tmp = x / y; elseif (x <= -1.25e+47) tmp = 1.0; elseif (x <= -3.6e+28) tmp = x / y; elseif (x <= 1.3e-66) tmp = t_0; elseif (x <= 7e-16) tmp = (x * x) / y; elseif (x <= 6.5e+121) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.8e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.25e+47], 1.0, If[LessEqual[x, -3.6e+28], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.3e-66], t$95$0, If[LessEqual[x, 7e-16], N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 6.5e+121], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{+47}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-16}:\\
\;\;\;\;\frac{x \cdot x}{y}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.79999999999999977e101 or -1.25000000000000005e47 < x < -3.5999999999999999e28 or 6.50000000000000019e121 < x Initial program 69.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 87.2%
if -4.79999999999999977e101 < x < -1.25000000000000005e47Initial program 100.0%
div-inv99.8%
*-commutative99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in x around inf 79.1%
if -3.5999999999999999e28 < x < 1.2999999999999999e-66 or 7.00000000000000035e-16 < x < 6.50000000000000019e121Initial program 98.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 73.4%
if 1.2999999999999999e-66 < x < 7.00000000000000035e-16Initial program 99.4%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 78.7%
Taylor expanded in x around 0 78.7%
Taylor expanded in x around 0 78.7%
unpow278.7%
Simplified78.7%
Final simplification78.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -4.9e+101)
(/ x y)
(if (<= x -8.4e+47)
1.0
(if (<= x -8e+26)
(/ x y)
(if (<= x 1.25e-66)
t_0
(if (<= x 1.7e-13)
(* (/ 1.0 y) (* x x))
(if (<= x 1.65e+121) t_0 (/ x y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.9e+101) {
tmp = x / y;
} else if (x <= -8.4e+47) {
tmp = 1.0;
} else if (x <= -8e+26) {
tmp = x / y;
} else if (x <= 1.25e-66) {
tmp = t_0;
} else if (x <= 1.7e-13) {
tmp = (1.0 / y) * (x * x);
} else if (x <= 1.65e+121) {
tmp = t_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 / (x + 1.0d0)
if (x <= (-4.9d+101)) then
tmp = x / y
else if (x <= (-8.4d+47)) then
tmp = 1.0d0
else if (x <= (-8d+26)) then
tmp = x / y
else if (x <= 1.25d-66) then
tmp = t_0
else if (x <= 1.7d-13) then
tmp = (1.0d0 / y) * (x * x)
else if (x <= 1.65d+121) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -4.9e+101) {
tmp = x / y;
} else if (x <= -8.4e+47) {
tmp = 1.0;
} else if (x <= -8e+26) {
tmp = x / y;
} else if (x <= 1.25e-66) {
tmp = t_0;
} else if (x <= 1.7e-13) {
tmp = (1.0 / y) * (x * x);
} else if (x <= 1.65e+121) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -4.9e+101: tmp = x / y elif x <= -8.4e+47: tmp = 1.0 elif x <= -8e+26: tmp = x / y elif x <= 1.25e-66: tmp = t_0 elif x <= 1.7e-13: tmp = (1.0 / y) * (x * x) elif x <= 1.65e+121: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -4.9e+101) tmp = Float64(x / y); elseif (x <= -8.4e+47) tmp = 1.0; elseif (x <= -8e+26) tmp = Float64(x / y); elseif (x <= 1.25e-66) tmp = t_0; elseif (x <= 1.7e-13) tmp = Float64(Float64(1.0 / y) * Float64(x * x)); elseif (x <= 1.65e+121) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -4.9e+101) tmp = x / y; elseif (x <= -8.4e+47) tmp = 1.0; elseif (x <= -8e+26) tmp = x / y; elseif (x <= 1.25e-66) tmp = t_0; elseif (x <= 1.7e-13) tmp = (1.0 / y) * (x * x); elseif (x <= 1.65e+121) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.9e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -8.4e+47], 1.0, If[LessEqual[x, -8e+26], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.25e-66], t$95$0, If[LessEqual[x, 1.7e-13], N[(N[(1.0 / y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+121], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -8.4 \cdot 10^{+47}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -8 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-13}:\\
\;\;\;\;\frac{1}{y} \cdot \left(x \cdot x\right)\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.89999999999999983e101 or -8.4e47 < x < -8.00000000000000038e26 or 1.6499999999999999e121 < x Initial program 69.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 87.2%
if -4.89999999999999983e101 < x < -8.4e47Initial program 100.0%
div-inv99.8%
*-commutative99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in x around inf 79.1%
if -8.00000000000000038e26 < x < 1.2499999999999999e-66 or 1.70000000000000008e-13 < x < 1.6499999999999999e121Initial program 98.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 73.4%
if 1.2499999999999999e-66 < x < 1.70000000000000008e-13Initial program 99.4%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 78.7%
Taylor expanded in x around 0 78.4%
associate-/l*78.7%
div-inv78.7%
*-commutative78.7%
Applied egg-rr78.7%
Final simplification78.7%
(FPCore (x y)
:precision binary64
(if (<= x -4.8e+101)
(/ x y)
(if (<= x -1.05e+47)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 4.5e-67)
x
(if (<= x 5.6e+15)
(* x (/ x y))
(if (<= x 1.65e+121) 1.0 (/ x y))))))))
double code(double x, double y) {
double tmp;
if (x <= -4.8e+101) {
tmp = x / y;
} else if (x <= -1.05e+47) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 4.5e-67) {
tmp = x;
} else if (x <= 5.6e+15) {
tmp = x * (x / y);
} else if (x <= 1.65e+121) {
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) :: tmp
if (x <= (-4.8d+101)) then
tmp = x / y
else if (x <= (-1.05d+47)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 4.5d-67) then
tmp = x
else if (x <= 5.6d+15) then
tmp = x * (x / y)
else if (x <= 1.65d+121) then
tmp = 1.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.8e+101) {
tmp = x / y;
} else if (x <= -1.05e+47) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 4.5e-67) {
tmp = x;
} else if (x <= 5.6e+15) {
tmp = x * (x / y);
} else if (x <= 1.65e+121) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.8e+101: tmp = x / y elif x <= -1.05e+47: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 4.5e-67: tmp = x elif x <= 5.6e+15: tmp = x * (x / y) elif x <= 1.65e+121: tmp = 1.0 else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -4.8e+101) tmp = Float64(x / y); elseif (x <= -1.05e+47) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 4.5e-67) tmp = x; elseif (x <= 5.6e+15) tmp = Float64(x * Float64(x / y)); elseif (x <= 1.65e+121) tmp = 1.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.8e+101) tmp = x / y; elseif (x <= -1.05e+47) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 4.5e-67) tmp = x; elseif (x <= 5.6e+15) tmp = x * (x / y); elseif (x <= 1.65e+121) tmp = 1.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.8e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.05e+47], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 4.5e-67], x, If[LessEqual[x, 5.6e+15], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+121], 1.0, N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{+47}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-67}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+121}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.79999999999999977e101 or -1.05e47 < x < -1 or 1.6499999999999999e121 < x Initial program 70.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 83.4%
if -4.79999999999999977e101 < x < -1.05e47 or 5.6e15 < x < 1.6499999999999999e121Initial program 92.5%
div-inv92.5%
*-commutative92.5%
fma-def92.5%
Applied egg-rr92.5%
Taylor expanded in y around inf 67.9%
+-commutative67.9%
Simplified67.9%
Taylor expanded in x around inf 67.9%
if -1 < x < 4.50000000000000015e-67Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 75.4%
if 4.50000000000000015e-67 < x < 5.6e15Initial program 99.4%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 76.1%
Taylor expanded in x around 0 63.8%
associate-/r/63.6%
Applied egg-rr63.6%
Final simplification76.8%
(FPCore (x y)
:precision binary64
(if (<= x -5e+101)
(/ x y)
(if (<= x -4.15e+46)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 0.00125) x (if (<= x 3.3e+121) 1.0 (/ x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -5e+101) {
tmp = x / y;
} else if (x <= -4.15e+46) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 0.00125) {
tmp = x;
} else if (x <= 3.3e+121) {
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) :: tmp
if (x <= (-5d+101)) then
tmp = x / y
else if (x <= (-4.15d+46)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 0.00125d0) then
tmp = x
else if (x <= 3.3d+121) then
tmp = 1.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5e+101) {
tmp = x / y;
} else if (x <= -4.15e+46) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 0.00125) {
tmp = x;
} else if (x <= 3.3e+121) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e+101: tmp = x / y elif x <= -4.15e+46: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 0.00125: tmp = x elif x <= 3.3e+121: tmp = 1.0 else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -5e+101) tmp = Float64(x / y); elseif (x <= -4.15e+46) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 0.00125) tmp = x; elseif (x <= 3.3e+121) tmp = 1.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e+101) tmp = x / y; elseif (x <= -4.15e+46) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 0.00125) tmp = x; elseif (x <= 3.3e+121) tmp = 1.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -4.15e+46], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 0.00125], x, If[LessEqual[x, 3.3e+121], 1.0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -4.15 \cdot 10^{+46}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 0.00125:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+121}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.99999999999999989e101 or -4.14999999999999976e46 < x < -1 or 3.29999999999999979e121 < x Initial program 70.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 83.4%
if -4.99999999999999989e101 < x < -4.14999999999999976e46 or 0.00125000000000000003 < x < 3.29999999999999979e121Initial program 92.9%
div-inv92.8%
*-commutative92.8%
fma-def92.8%
Applied egg-rr92.8%
Taylor expanded in y around inf 64.6%
+-commutative64.6%
Simplified64.6%
Taylor expanded in x around inf 64.6%
if -1 < x < 0.00125000000000000003Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 70.8%
Final simplification74.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (/ (+ x -1.0) y) 1.0)))
(if (<= x -15200.0)
t_0
(if (<= x 4e-69)
(/ x (+ x 1.0))
(if (<= x 1.0) (* (/ 1.0 y) (* x x)) t_0)))))
double code(double x, double y) {
double t_0 = ((x + -1.0) / y) + 1.0;
double tmp;
if (x <= -15200.0) {
tmp = t_0;
} else if (x <= 4e-69) {
tmp = x / (x + 1.0);
} else if (x <= 1.0) {
tmp = (1.0 / y) * (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) :: tmp
t_0 = ((x + (-1.0d0)) / y) + 1.0d0
if (x <= (-15200.0d0)) then
tmp = t_0
else if (x <= 4d-69) then
tmp = x / (x + 1.0d0)
else if (x <= 1.0d0) then
tmp = (1.0d0 / y) * (x * x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x + -1.0) / y) + 1.0;
double tmp;
if (x <= -15200.0) {
tmp = t_0;
} else if (x <= 4e-69) {
tmp = x / (x + 1.0);
} else if (x <= 1.0) {
tmp = (1.0 / y) * (x * x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = ((x + -1.0) / y) + 1.0 tmp = 0 if x <= -15200.0: tmp = t_0 elif x <= 4e-69: tmp = x / (x + 1.0) elif x <= 1.0: tmp = (1.0 / y) * (x * x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x + -1.0) / y) + 1.0) tmp = 0.0 if (x <= -15200.0) tmp = t_0; elseif (x <= 4e-69) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1.0) tmp = Float64(Float64(1.0 / y) * Float64(x * x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = ((x + -1.0) / y) + 1.0; tmp = 0.0; if (x <= -15200.0) tmp = t_0; elseif (x <= 4e-69) tmp = x / (x + 1.0); elseif (x <= 1.0) tmp = (1.0 / y) * (x * x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -15200.0], t$95$0, If[LessEqual[x, 4e-69], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(N[(1.0 / y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + -1}{y} + 1\\
\mathbf{if}\;x \leq -15200:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-69}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{1}{y} \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -15200 or 1 < x Initial program 77.0%
div-inv77.0%
*-commutative77.0%
fma-def76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -15200 < x < 3.9999999999999999e-69Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.0%
if 3.9999999999999999e-69 < x < 1Initial program 99.3%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 74.1%
Taylor expanded in x around 0 68.3%
associate-/l*68.5%
div-inv68.5%
*-commutative68.5%
Applied egg-rr68.5%
Final simplification88.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (/ (+ x -1.0) y) 1.0)))
(if (<= x -1650.0)
t_0
(if (<= x 1.02e-66)
(/ x (+ x 1.0))
(if (<= x 1100.0) (/ x (+ y (/ y x))) t_0)))))
double code(double x, double y) {
double t_0 = ((x + -1.0) / y) + 1.0;
double tmp;
if (x <= -1650.0) {
tmp = t_0;
} else if (x <= 1.02e-66) {
tmp = x / (x + 1.0);
} else if (x <= 1100.0) {
tmp = x / (y + (y / 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) :: tmp
t_0 = ((x + (-1.0d0)) / y) + 1.0d0
if (x <= (-1650.0d0)) then
tmp = t_0
else if (x <= 1.02d-66) then
tmp = x / (x + 1.0d0)
else if (x <= 1100.0d0) then
tmp = x / (y + (y / x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x + -1.0) / y) + 1.0;
double tmp;
if (x <= -1650.0) {
tmp = t_0;
} else if (x <= 1.02e-66) {
tmp = x / (x + 1.0);
} else if (x <= 1100.0) {
tmp = x / (y + (y / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = ((x + -1.0) / y) + 1.0 tmp = 0 if x <= -1650.0: tmp = t_0 elif x <= 1.02e-66: tmp = x / (x + 1.0) elif x <= 1100.0: tmp = x / (y + (y / x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x + -1.0) / y) + 1.0) tmp = 0.0 if (x <= -1650.0) tmp = t_0; elseif (x <= 1.02e-66) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1100.0) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = ((x + -1.0) / y) + 1.0; tmp = 0.0; if (x <= -1650.0) tmp = t_0; elseif (x <= 1.02e-66) tmp = x / (x + 1.0); elseif (x <= 1100.0) tmp = x / (y + (y / x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1650.0], t$95$0, If[LessEqual[x, 1.02e-66], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1100.0], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + -1}{y} + 1\\
\mathbf{if}\;x \leq -1650:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-66}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1100:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1650 or 1100 < x Initial program 77.0%
div-inv77.0%
*-commutative77.0%
fma-def76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -1650 < x < 1.01999999999999996e-66Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.0%
if 1.01999999999999996e-66 < x < 1100Initial program 99.3%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 74.1%
Taylor expanded in x around 0 74.1%
Final simplification88.8%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.2))) (+ (/ (+ x -1.0) y) 1.0) (* x (+ (/ x y) 1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.2)) {
tmp = ((x + -1.0) / y) + 1.0;
} else {
tmp = x * ((x / y) + 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)) .or. (.not. (x <= 1.2d0))) then
tmp = ((x + (-1.0d0)) / y) + 1.0d0
else
tmp = x * ((x / y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.2)) {
tmp = ((x + -1.0) / y) + 1.0;
} else {
tmp = x * ((x / y) + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.2): tmp = ((x + -1.0) / y) + 1.0 else: tmp = x * ((x / y) + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.2)) tmp = Float64(Float64(Float64(x + -1.0) / y) + 1.0); else tmp = Float64(x * Float64(Float64(x / y) + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.2))) tmp = ((x + -1.0) / y) + 1.0; else tmp = x * ((x / y) + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.2]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision], N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1.2\right):\\
\;\;\;\;\frac{x + -1}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{x}{y} + 1\right)\\
\end{array}
\end{array}
if x < -1 or 1.19999999999999996 < x Initial program 77.0%
div-inv77.0%
*-commutative77.0%
fma-def76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -1 < x < 1.19999999999999996Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
associate-/l*99.9%
frac-2neg99.9%
div-inv99.8%
*-commutative99.8%
neg-sub099.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
distribute-rgt-neg-in99.8%
neg-sub099.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 97.4%
Final simplification98.7%
(FPCore (x y) :precision binary64 (if (<= x -100000000000.0) 1.0 (if (<= x 0.00125) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -100000000000.0) {
tmp = 1.0;
} else if (x <= 0.00125) {
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 <= (-100000000000.0d0)) then
tmp = 1.0d0
else if (x <= 0.00125d0) 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 <= -100000000000.0) {
tmp = 1.0;
} else if (x <= 0.00125) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -100000000000.0: tmp = 1.0 elif x <= 0.00125: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -100000000000.0) tmp = 1.0; elseif (x <= 0.00125) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -100000000000.0) tmp = 1.0; elseif (x <= 0.00125) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -100000000000.0], 1.0, If[LessEqual[x, 0.00125], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -100000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 0.00125:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1e11 or 0.00125000000000000003 < x Initial program 76.8%
div-inv76.8%
*-commutative76.8%
fma-def76.8%
Applied egg-rr76.8%
Taylor expanded in y around inf 30.2%
+-commutative30.2%
Simplified30.2%
Taylor expanded in x around inf 30.1%
if -1e11 < x < 0.00125000000000000003Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 69.8%
Final simplification49.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 88.0%
div-inv87.9%
*-commutative87.9%
fma-def87.9%
Applied egg-rr87.9%
Taylor expanded in y around inf 50.2%
+-commutative50.2%
Simplified50.2%
Taylor expanded in x around inf 17.2%
Final simplification17.2%
(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 2023297
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:herbie-target
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))