
(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 14 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) t_0) t_0)))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
return ((x / y) * t_0) + t_0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = x / (x + 1.0d0)
code = ((x / y) * t_0) + t_0
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
return ((x / y) * t_0) + t_0;
}
def code(x, y): t_0 = x / (x + 1.0) return ((x / y) * t_0) + t_0
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) return Float64(Float64(Float64(x / y) * t_0) + t_0) end
function tmp = code(x, y) t_0 = x / (x + 1.0); tmp = ((x / y) * t_0) + t_0; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(x / y), $MachinePrecision] * t$95$0), $MachinePrecision] + t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\frac{x}{y} \cdot t\_0 + t\_0
\end{array}
\end{array}
Initial program 89.3%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
associate-/r/99.9%
+-commutative99.9%
un-div-inv99.8%
+-commutative99.8%
distribute-lft-in99.8%
*-commutative99.8%
*-un-lft-identity99.8%
un-div-inv99.9%
+-commutative99.9%
un-div-inv99.9%
+-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -3.6e+129)
(/ x y)
(if (<= x -2.05e+106)
1.0
(if (<= x -1950000000.0)
(/ x y)
(if (<= x 1.45e-52)
t_0
(if (<= x 9e-9)
(* x (/ x y))
(if (<= x 2.65e+14) t_0 (/ x y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -3.6e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -1950000000.0) {
tmp = x / y;
} else if (x <= 1.45e-52) {
tmp = t_0;
} else if (x <= 9e-9) {
tmp = x * (x / y);
} else if (x <= 2.65e+14) {
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 <= (-3.6d+129)) then
tmp = x / y
else if (x <= (-2.05d+106)) then
tmp = 1.0d0
else if (x <= (-1950000000.0d0)) then
tmp = x / y
else if (x <= 1.45d-52) then
tmp = t_0
else if (x <= 9d-9) then
tmp = x * (x / y)
else if (x <= 2.65d+14) 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 <= -3.6e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -1950000000.0) {
tmp = x / y;
} else if (x <= 1.45e-52) {
tmp = t_0;
} else if (x <= 9e-9) {
tmp = x * (x / y);
} else if (x <= 2.65e+14) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -3.6e+129: tmp = x / y elif x <= -2.05e+106: tmp = 1.0 elif x <= -1950000000.0: tmp = x / y elif x <= 1.45e-52: tmp = t_0 elif x <= 9e-9: tmp = x * (x / y) elif x <= 2.65e+14: 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 <= -3.6e+129) tmp = Float64(x / y); elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -1950000000.0) tmp = Float64(x / y); elseif (x <= 1.45e-52) tmp = t_0; elseif (x <= 9e-9) tmp = Float64(x * Float64(x / y)); elseif (x <= 2.65e+14) 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 <= -3.6e+129) tmp = x / y; elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -1950000000.0) tmp = x / y; elseif (x <= 1.45e-52) tmp = t_0; elseif (x <= 9e-9) tmp = x * (x / y); elseif (x <= 2.65e+14) 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, -3.6e+129], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+106], 1.0, If[LessEqual[x, -1950000000.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.45e-52], t$95$0, If[LessEqual[x, 9e-9], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.65e+14], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1950000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.6000000000000001e129 or -2.0500000000000001e106 < x < -1.95e9 or 2.65e14 < x Initial program 77.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 77.7%
if -3.6000000000000001e129 < x < -2.0500000000000001e106Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
un-div-inv100.0%
clear-num100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -1.95e9 < x < 1.4500000000000001e-52 or 8.99999999999999953e-9 < x < 2.65e14Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if 1.4500000000000001e-52 < x < 8.99999999999999953e-9Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around 0 77.5%
Taylor expanded in x around 0 69.3%
Final simplification79.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -3.4e+129)
(/ x y)
(if (<= x -2.05e+106)
1.0
(if (<= x -600000000.0)
(/ (+ x -1.0) y)
(if (<= x 1.25e-52)
t_0
(if (<= x 1.05e-8)
(* x (/ x y))
(if (<= x 2.3e+14) t_0 (/ x y)))))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -3.4e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -600000000.0) {
tmp = (x + -1.0) / y;
} else if (x <= 1.25e-52) {
tmp = t_0;
} else if (x <= 1.05e-8) {
tmp = x * (x / y);
} else if (x <= 2.3e+14) {
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 <= (-3.4d+129)) then
tmp = x / y
else if (x <= (-2.05d+106)) then
tmp = 1.0d0
else if (x <= (-600000000.0d0)) then
tmp = (x + (-1.0d0)) / y
else if (x <= 1.25d-52) then
tmp = t_0
else if (x <= 1.05d-8) then
tmp = x * (x / y)
else if (x <= 2.3d+14) 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 <= -3.4e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -600000000.0) {
tmp = (x + -1.0) / y;
} else if (x <= 1.25e-52) {
tmp = t_0;
} else if (x <= 1.05e-8) {
tmp = x * (x / y);
} else if (x <= 2.3e+14) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -3.4e+129: tmp = x / y elif x <= -2.05e+106: tmp = 1.0 elif x <= -600000000.0: tmp = (x + -1.0) / y elif x <= 1.25e-52: tmp = t_0 elif x <= 1.05e-8: tmp = x * (x / y) elif x <= 2.3e+14: 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 <= -3.4e+129) tmp = Float64(x / y); elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -600000000.0) tmp = Float64(Float64(x + -1.0) / y); elseif (x <= 1.25e-52) tmp = t_0; elseif (x <= 1.05e-8) tmp = Float64(x * Float64(x / y)); elseif (x <= 2.3e+14) 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 <= -3.4e+129) tmp = x / y; elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -600000000.0) tmp = (x + -1.0) / y; elseif (x <= 1.25e-52) tmp = t_0; elseif (x <= 1.05e-8) tmp = x * (x / y); elseif (x <= 2.3e+14) 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, -3.4e+129], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+106], 1.0, If[LessEqual[x, -600000000.0], N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1.25e-52], t$95$0, If[LessEqual[x, 1.05e-8], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e+14], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -600000000:\\
\;\;\;\;\frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.40000000000000018e129 or 2.3e14 < x Initial program 73.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 81.1%
if -3.40000000000000018e129 < x < -2.0500000000000001e106Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
un-div-inv100.0%
clear-num100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -2.0500000000000001e106 < x < -6e8Initial program 95.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around 0 63.5%
if -6e8 < x < 1.25e-52 or 1.04999999999999997e-8 < x < 2.3e14Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if 1.25e-52 < x < 1.04999999999999997e-8Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around 0 77.5%
Taylor expanded in x around 0 69.3%
Final simplification80.1%
(FPCore (x y)
:precision binary64
(if (<= x -9e+129)
(/ x y)
(if (<= x -2.05e+106)
1.0
(if (<= x -180000000.0)
(/ (+ x -1.0) y)
(if (<= x 1e-52)
(* x (/ 1.0 (+ x 1.0)))
(if (<= x 6.8e-9)
(* x (/ x y))
(if (<= x 7.5e+18) (/ x (+ x 1.0)) (/ x y))))))))
double code(double x, double y) {
double tmp;
if (x <= -9e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -180000000.0) {
tmp = (x + -1.0) / y;
} else if (x <= 1e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 6.8e-9) {
tmp = x * (x / y);
} else if (x <= 7.5e+18) {
tmp = x / (x + 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 <= (-9d+129)) then
tmp = x / y
else if (x <= (-2.05d+106)) then
tmp = 1.0d0
else if (x <= (-180000000.0d0)) then
tmp = (x + (-1.0d0)) / y
else if (x <= 1d-52) then
tmp = x * (1.0d0 / (x + 1.0d0))
else if (x <= 6.8d-9) then
tmp = x * (x / y)
else if (x <= 7.5d+18) then
tmp = x / (x + 1.0d0)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -9e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -180000000.0) {
tmp = (x + -1.0) / y;
} else if (x <= 1e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 6.8e-9) {
tmp = x * (x / y);
} else if (x <= 7.5e+18) {
tmp = x / (x + 1.0);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9e+129: tmp = x / y elif x <= -2.05e+106: tmp = 1.0 elif x <= -180000000.0: tmp = (x + -1.0) / y elif x <= 1e-52: tmp = x * (1.0 / (x + 1.0)) elif x <= 6.8e-9: tmp = x * (x / y) elif x <= 7.5e+18: tmp = x / (x + 1.0) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -9e+129) tmp = Float64(x / y); elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -180000000.0) tmp = Float64(Float64(x + -1.0) / y); elseif (x <= 1e-52) tmp = Float64(x * Float64(1.0 / Float64(x + 1.0))); elseif (x <= 6.8e-9) tmp = Float64(x * Float64(x / y)); elseif (x <= 7.5e+18) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9e+129) tmp = x / y; elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -180000000.0) tmp = (x + -1.0) / y; elseif (x <= 1e-52) tmp = x * (1.0 / (x + 1.0)); elseif (x <= 6.8e-9) tmp = x * (x / y); elseif (x <= 7.5e+18) tmp = x / (x + 1.0); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9e+129], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+106], 1.0, If[LessEqual[x, -180000000.0], N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1e-52], N[(x * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e-9], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e+18], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -180000000:\\
\;\;\;\;\frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 10^{-52}:\\
\;\;\;\;x \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+18}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -9.0000000000000003e129 or 7.5e18 < x Initial program 73.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 81.1%
if -9.0000000000000003e129 < x < -2.0500000000000001e106Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
un-div-inv100.0%
clear-num100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -2.0500000000000001e106 < x < -1.8e8Initial program 95.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 100.0%
Taylor expanded in y around 0 63.5%
if -1.8e8 < x < 1e-52Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.0%
if 1e-52 < x < 6.7999999999999997e-9Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around 0 77.5%
Taylor expanded in x around 0 69.3%
if 6.7999999999999997e-9 < x < 7.5e18Initial program 99.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around inf 95.0%
Final simplification80.1%
(FPCore (x y)
:precision binary64
(if (<= x -3.4e+129)
(/ x y)
(if (<= x -2.05e+106)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 1.3e-52)
(* x (- 1.0 x))
(if (<= x 420000000000.0) (* x (/ x y)) (/ x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -3.4e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.3e-52) {
tmp = x * (1.0 - x);
} else if (x <= 420000000000.0) {
tmp = x * (x / y);
} 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 <= (-3.4d+129)) then
tmp = x / y
else if (x <= (-2.05d+106)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 1.3d-52) then
tmp = x * (1.0d0 - x)
else if (x <= 420000000000.0d0) then
tmp = x * (x / y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.4e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.3e-52) {
tmp = x * (1.0 - x);
} else if (x <= 420000000000.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.4e+129: tmp = x / y elif x <= -2.05e+106: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 1.3e-52: tmp = x * (1.0 - x) elif x <= 420000000000.0: tmp = x * (x / y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -3.4e+129) tmp = Float64(x / y); elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 1.3e-52) tmp = Float64(x * Float64(1.0 - x)); elseif (x <= 420000000000.0) tmp = Float64(x * Float64(x / y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.4e+129) tmp = x / y; elseif (x <= -2.05e+106) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 1.3e-52) tmp = x * (1.0 - x); elseif (x <= 420000000000.0) tmp = x * (x / y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.4e+129], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+106], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.3e-52], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 420000000000.0], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-52}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{elif}\;x \leq 420000000000:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -3.40000000000000018e129 or -2.0500000000000001e106 < x < -1 or 4.2e11 < x Initial program 77.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 76.1%
if -3.40000000000000018e129 < x < -2.0500000000000001e106Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
un-div-inv100.0%
clear-num100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -1 < x < 1.2999999999999999e-52Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
Taylor expanded in x around 0 82.0%
neg-mul-182.0%
sub-neg82.0%
Simplified82.0%
if 1.2999999999999999e-52 < x < 4.2e11Initial program 99.6%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 60.0%
Taylor expanded in x around 0 53.8%
Final simplification77.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= x -145000000.0)
t_0
(if (<= x 1.3e-52)
(* x (/ 1.0 (+ x 1.0)))
(if (<= x 6.8e-9)
(* x (/ x y))
(if (<= x 420000000000.0) (/ x (+ x 1.0)) t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -145000000.0) {
tmp = t_0;
} else if (x <= 1.3e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 6.8e-9) {
tmp = x * (x / y);
} else if (x <= 420000000000.0) {
tmp = x / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((x + (-1.0d0)) / y)
if (x <= (-145000000.0d0)) then
tmp = t_0
else if (x <= 1.3d-52) then
tmp = x * (1.0d0 / (x + 1.0d0))
else if (x <= 6.8d-9) then
tmp = x * (x / y)
else if (x <= 420000000000.0d0) then
tmp = x / (x + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -145000000.0) {
tmp = t_0;
} else if (x <= 1.3e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 6.8e-9) {
tmp = x * (x / y);
} else if (x <= 420000000000.0) {
tmp = x / (x + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) tmp = 0 if x <= -145000000.0: tmp = t_0 elif x <= 1.3e-52: tmp = x * (1.0 / (x + 1.0)) elif x <= 6.8e-9: tmp = x * (x / y) elif x <= 420000000000.0: tmp = x / (x + 1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x + -1.0) / y)) tmp = 0.0 if (x <= -145000000.0) tmp = t_0; elseif (x <= 1.3e-52) tmp = Float64(x * Float64(1.0 / Float64(x + 1.0))); elseif (x <= 6.8e-9) tmp = Float64(x * Float64(x / y)); elseif (x <= 420000000000.0) tmp = Float64(x / Float64(x + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x + -1.0) / y); tmp = 0.0; if (x <= -145000000.0) tmp = t_0; elseif (x <= 1.3e-52) tmp = x * (1.0 / (x + 1.0)); elseif (x <= 6.8e-9) tmp = x * (x / y); elseif (x <= 420000000000.0) tmp = x / (x + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -145000000.0], t$95$0, If[LessEqual[x, 1.3e-52], N[(x * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e-9], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 420000000000.0], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;x \leq -145000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-52}:\\
\;\;\;\;x \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 420000000000:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.45e8 or 4.2e11 < x Initial program 78.0%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
remove-double-neg100.0%
neg-mul-1100.0%
distribute-lft-in100.0%
neg-mul-1100.0%
associate-*r/100.0%
mul-1-neg100.0%
unsub-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
if -1.45e8 < x < 1.2999999999999999e-52Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.0%
if 1.2999999999999999e-52 < x < 6.7999999999999997e-9Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around 0 77.5%
Taylor expanded in x around 0 69.3%
if 6.7999999999999997e-9 < x < 4.2e11Initial program 99.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around inf 95.0%
Final simplification90.3%
(FPCore (x y)
:precision binary64
(if (<= x -3.9e+129)
(/ x y)
(if (<= x -2.05e+106)
1.0
(if (or (<= x -1.0) (not (<= x 0.55))) (/ x y) (* x (- 1.0 x))))))
double code(double x, double y) {
double tmp;
if (x <= -3.9e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if ((x <= -1.0) || !(x <= 0.55)) {
tmp = x / y;
} else {
tmp = x * (1.0 - x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.9d+129)) then
tmp = x / y
else if (x <= (-2.05d+106)) then
tmp = 1.0d0
else if ((x <= (-1.0d0)) .or. (.not. (x <= 0.55d0))) then
tmp = x / y
else
tmp = x * (1.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.9e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if ((x <= -1.0) || !(x <= 0.55)) {
tmp = x / y;
} else {
tmp = x * (1.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.9e+129: tmp = x / y elif x <= -2.05e+106: tmp = 1.0 elif (x <= -1.0) or not (x <= 0.55): tmp = x / y else: tmp = x * (1.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -3.9e+129) tmp = Float64(x / y); elseif (x <= -2.05e+106) tmp = 1.0; elseif ((x <= -1.0) || !(x <= 0.55)) tmp = Float64(x / y); else tmp = Float64(x * Float64(1.0 - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.9e+129) tmp = x / y; elseif (x <= -2.05e+106) tmp = 1.0; elseif ((x <= -1.0) || ~((x <= 0.55))) tmp = x / y; else tmp = x * (1.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.9e+129], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+106], 1.0, If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.55]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1 \lor \neg \left(x \leq 0.55\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\end{array}
\end{array}
if x < -3.8999999999999997e129 or -2.0500000000000001e106 < x < -1 or 0.55000000000000004 < x Initial program 77.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 74.9%
if -3.8999999999999997e129 < x < -2.0500000000000001e106Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
un-div-inv100.0%
clear-num100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -1 < x < 0.55000000000000004Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 76.8%
Taylor expanded in x around 0 76.0%
neg-mul-176.0%
sub-neg76.0%
Simplified76.0%
Final simplification76.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= x -145000000.0)
t_0
(if (<= x 1.42e-52)
(* x (/ 1.0 (+ x 1.0)))
(if (<= x 2.4e-8) (* x (/ x (* y (+ x 1.0)))) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -145000000.0) {
tmp = t_0;
} else if (x <= 1.42e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 2.4e-8) {
tmp = x * (x / (y * (x + 1.0)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((x + (-1.0d0)) / y)
if (x <= (-145000000.0d0)) then
tmp = t_0
else if (x <= 1.42d-52) then
tmp = x * (1.0d0 / (x + 1.0d0))
else if (x <= 2.4d-8) then
tmp = x * (x / (y * (x + 1.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -145000000.0) {
tmp = t_0;
} else if (x <= 1.42e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 2.4e-8) {
tmp = x * (x / (y * (x + 1.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) tmp = 0 if x <= -145000000.0: tmp = t_0 elif x <= 1.42e-52: tmp = x * (1.0 / (x + 1.0)) elif x <= 2.4e-8: tmp = x * (x / (y * (x + 1.0))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x + -1.0) / y)) tmp = 0.0 if (x <= -145000000.0) tmp = t_0; elseif (x <= 1.42e-52) tmp = Float64(x * Float64(1.0 / Float64(x + 1.0))); elseif (x <= 2.4e-8) tmp = Float64(x * Float64(x / Float64(y * Float64(x + 1.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x + -1.0) / y); tmp = 0.0; if (x <= -145000000.0) tmp = t_0; elseif (x <= 1.42e-52) tmp = x * (1.0 / (x + 1.0)); elseif (x <= 2.4e-8) tmp = x * (x / (y * (x + 1.0))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -145000000.0], t$95$0, If[LessEqual[x, 1.42e-52], N[(x * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e-8], N[(x * N[(x / N[(y * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;x \leq -145000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{-52}:\\
\;\;\;\;x \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.45e8 or 2.39999999999999998e-8 < x Initial program 78.6%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.2%
associate--l+98.2%
div-sub98.2%
sub-neg98.2%
metadata-eval98.2%
+-commutative98.2%
metadata-eval98.2%
remove-double-neg98.2%
neg-mul-198.2%
distribute-lft-in98.2%
neg-mul-198.2%
associate-*r/98.2%
mul-1-neg98.2%
unsub-neg98.2%
neg-mul-198.2%
sub-neg98.2%
Simplified98.2%
if -1.45e8 < x < 1.4200000000000001e-52Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.0%
if 1.4200000000000001e-52 < x < 2.39999999999999998e-8Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around 0 77.5%
Final simplification89.9%
(FPCore (x y)
:precision binary64
(if (<= x -145000000.0)
(+ 1.0 (/ (+ x -1.0) y))
(if (<= x 1.25e-52)
(* x (/ 1.0 (+ x 1.0)))
(if (<= x 8.5e-9)
(* x (/ x (* y (+ x 1.0))))
(+ (/ x y) (/ x (+ x 1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -145000000.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 1.25e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 8.5e-9) {
tmp = x * (x / (y * (x + 1.0)));
} else {
tmp = (x / y) + (x / (x + 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 <= (-145000000.0d0)) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else if (x <= 1.25d-52) then
tmp = x * (1.0d0 / (x + 1.0d0))
else if (x <= 8.5d-9) then
tmp = x * (x / (y * (x + 1.0d0)))
else
tmp = (x / y) + (x / (x + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -145000000.0) {
tmp = 1.0 + ((x + -1.0) / y);
} else if (x <= 1.25e-52) {
tmp = x * (1.0 / (x + 1.0));
} else if (x <= 8.5e-9) {
tmp = x * (x / (y * (x + 1.0)));
} else {
tmp = (x / y) + (x / (x + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -145000000.0: tmp = 1.0 + ((x + -1.0) / y) elif x <= 1.25e-52: tmp = x * (1.0 / (x + 1.0)) elif x <= 8.5e-9: tmp = x * (x / (y * (x + 1.0))) else: tmp = (x / y) + (x / (x + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (x <= -145000000.0) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); elseif (x <= 1.25e-52) tmp = Float64(x * Float64(1.0 / Float64(x + 1.0))); elseif (x <= 8.5e-9) tmp = Float64(x * Float64(x / Float64(y * Float64(x + 1.0)))); else tmp = Float64(Float64(x / y) + Float64(x / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -145000000.0) tmp = 1.0 + ((x + -1.0) / y); elseif (x <= 1.25e-52) tmp = x * (1.0 / (x + 1.0)); elseif (x <= 8.5e-9) tmp = x * (x / (y * (x + 1.0))); else tmp = (x / y) + (x / (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -145000000.0], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e-52], N[(x * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-9], N[(x * N[(x / N[(y * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -145000000:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-52}:\\
\;\;\;\;x \cdot \frac{1}{x + 1}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \frac{x}{y \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.45e8Initial program 82.4%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
metadata-eval100.0%
remove-double-neg100.0%
neg-mul-1100.0%
distribute-lft-in100.0%
neg-mul-1100.0%
associate-*r/100.0%
mul-1-neg100.0%
unsub-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
if -1.45e8 < x < 1.25e-52Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.0%
if 1.25e-52 < x < 8.5e-9Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around 0 77.5%
if 8.5e-9 < x Initial program 75.4%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
associate-/r/100.0%
+-commutative100.0%
un-div-inv99.7%
+-commutative99.7%
distribute-lft-in99.7%
*-commutative99.7%
*-un-lft-identity99.7%
un-div-inv99.8%
+-commutative99.8%
un-div-inv100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
Final simplification90.8%
(FPCore (x y)
:precision binary64
(if (<= x -3.4e+129)
(/ x y)
(if (<= x -2.05e+106)
1.0
(if (or (<= x -1.0) (not (<= x 420000000000.0))) (/ x y) x))))
double code(double x, double y) {
double tmp;
if (x <= -3.4e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if ((x <= -1.0) || !(x <= 420000000000.0)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.4d+129)) then
tmp = x / y
else if (x <= (-2.05d+106)) then
tmp = 1.0d0
else if ((x <= (-1.0d0)) .or. (.not. (x <= 420000000000.0d0))) then
tmp = x / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.4e+129) {
tmp = x / y;
} else if (x <= -2.05e+106) {
tmp = 1.0;
} else if ((x <= -1.0) || !(x <= 420000000000.0)) {
tmp = x / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.4e+129: tmp = x / y elif x <= -2.05e+106: tmp = 1.0 elif (x <= -1.0) or not (x <= 420000000000.0): tmp = x / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (x <= -3.4e+129) tmp = Float64(x / y); elseif (x <= -2.05e+106) tmp = 1.0; elseif ((x <= -1.0) || !(x <= 420000000000.0)) tmp = Float64(x / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.4e+129) tmp = x / y; elseif (x <= -2.05e+106) tmp = 1.0; elseif ((x <= -1.0) || ~((x <= 420000000000.0))) tmp = x / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.4e+129], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+106], 1.0, If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 420000000000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+106}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1 \lor \neg \left(x \leq 420000000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.40000000000000018e129 or -2.0500000000000001e106 < x < -1 or 4.2e11 < x Initial program 77.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 76.1%
if -3.40000000000000018e129 < x < -2.0500000000000001e106Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
un-div-inv100.0%
clear-num100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
if -1 < x < 4.2e11Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 73.4%
Final simplification75.2%
(FPCore (x y) :precision binary64 (if (<= x -0.053) 1.0 (if (<= x 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -0.053) {
tmp = 1.0;
} else if (x <= 1.0) {
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 <= (-0.053d0)) then
tmp = 1.0d0
else if (x <= 1.0d0) 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 <= -0.053) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.053: tmp = 1.0 elif x <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -0.053) tmp = 1.0; elseif (x <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.053) tmp = 1.0; elseif (x <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.053], 1.0, If[LessEqual[x, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.053:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -0.0529999999999999985 or 1 < x Initial program 79.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 28.9%
un-div-inv29.0%
clear-num29.0%
+-commutative29.0%
Applied egg-rr29.0%
Taylor expanded in x around inf 28.1%
if -0.0529999999999999985 < x < 1Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 75.0%
Final simplification51.2%
(FPCore (x y) :precision binary64 (* x (/ (+ 1.0 (/ x y)) (+ x 1.0))))
double code(double x, double y) {
return x * ((1.0 + (x / y)) / (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)) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return x * ((1.0 + (x / y)) / (x + 1.0));
}
def code(x, y): return x * ((1.0 + (x / y)) / (x + 1.0))
function code(x, y) return Float64(x * Float64(Float64(1.0 + Float64(x / y)) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = x * ((1.0 + (x / y)) / (x + 1.0)); end
code[x_, y_] := N[(x * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{1 + \frac{x}{y}}{x + 1}
\end{array}
Initial program 89.3%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (/ x (/ (+ x 1.0) (+ 1.0 (/ x y)))))
double code(double x, double y) {
return x / ((x + 1.0) / (1.0 + (x / y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / ((x + 1.0d0) / (1.0d0 + (x / y)))
end function
public static double code(double x, double y) {
return x / ((x + 1.0) / (1.0 + (x / y)));
}
def code(x, y): return x / ((x + 1.0) / (1.0 + (x / y)))
function code(x, y) return Float64(x / Float64(Float64(x + 1.0) / Float64(1.0 + Float64(x / y)))) end
function tmp = code(x, y) tmp = x / ((x + 1.0) / (1.0 + (x / y))); end
code[x_, y_] := N[(x / N[(N[(x + 1.0), $MachinePrecision] / N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{x + 1}{1 + \frac{x}{y}}}
\end{array}
Initial program 89.3%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(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.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 52.8%
un-div-inv52.8%
clear-num52.7%
+-commutative52.7%
Applied egg-rr52.7%
Taylor expanded in x around inf 16.0%
Final simplification16.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 2024046
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:alt
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))