
(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 13 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
(if (<= x -7.4e+101)
(/ x y)
(if (<= x -1e+48)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 1.3e-66)
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 <= -7.4e+101) {
tmp = x / y;
} else if (x <= -1e+48) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.3e-66) {
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 <= (-7.4d+101)) then
tmp = x / y
else if (x <= (-1d+48)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 1.3d-66) 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 <= -7.4e+101) {
tmp = x / y;
} else if (x <= -1e+48) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.3e-66) {
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 <= -7.4e+101: tmp = x / y elif x <= -1e+48: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 1.3e-66: 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 <= -7.4e+101) tmp = Float64(x / y); elseif (x <= -1e+48) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 1.3e-66) 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 <= -7.4e+101) tmp = x / y; elseif (x <= -1e+48) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 1.3e-66) 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, -7.4e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -1e+48], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.3e-66], 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 -7.4 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1 \cdot 10^{+48}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;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 < -7.3999999999999995e101 or -1.00000000000000004e48 < 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 -7.3999999999999995e101 < x < -1.00000000000000004e48 or 5.6e15 < x < 1.6499999999999999e121Initial program 92.5%
clear-num92.5%
associate-/r/92.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 < 1.2999999999999999e-66Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 75.4%
if 1.2999999999999999e-66 < 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
(let* ((t_0 (+ (+ 1.0 (/ x y)) (/ -1.0 y))))
(if (<= x -15200.0)
t_0
(if (<= x 4e-69)
(/ x (+ x 1.0))
(if (<= x 21000.0) (/ x (+ y (/ y x))) t_0)))))
double code(double x, double y) {
double t_0 = (1.0 + (x / y)) + (-1.0 / y);
double tmp;
if (x <= -15200.0) {
tmp = t_0;
} else if (x <= 4e-69) {
tmp = x / (x + 1.0);
} else if (x <= 21000.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 = (1.0d0 + (x / y)) + ((-1.0d0) / y)
if (x <= (-15200.0d0)) then
tmp = t_0
else if (x <= 4d-69) then
tmp = x / (x + 1.0d0)
else if (x <= 21000.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 = (1.0 + (x / y)) + (-1.0 / y);
double tmp;
if (x <= -15200.0) {
tmp = t_0;
} else if (x <= 4e-69) {
tmp = x / (x + 1.0);
} else if (x <= 21000.0) {
tmp = x / (y + (y / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 + (x / y)) + (-1.0 / y) tmp = 0 if x <= -15200.0: tmp = t_0 elif x <= 4e-69: tmp = x / (x + 1.0) elif x <= 21000.0: tmp = x / (y + (y / x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 + Float64(x / y)) + Float64(-1.0 / y)) tmp = 0.0 if (x <= -15200.0) tmp = t_0; elseif (x <= 4e-69) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 21000.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 = (1.0 + (x / y)) + (-1.0 / y); tmp = 0.0; if (x <= -15200.0) tmp = t_0; elseif (x <= 4e-69) tmp = x / (x + 1.0); elseif (x <= 21000.0) tmp = x / (y + (y / x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $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, 21000.0], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + \frac{x}{y}\right) + \frac{-1}{y}\\
\mathbf{if}\;x \leq -15200:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-69}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 21000:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -15200 or 21000 < x Initial program 77.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 99.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 < 21000Initial 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
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (+ (+ 1.0 (/ x y)) (/ -1.0 y))))
(if (<= x -1650.0)
t_1
(if (<= x 1.02e-66) t_0 (if (<= x 1100.0) (/ (* x t_0) y) t_1)))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double t_1 = (1.0 + (x / y)) + (-1.0 / y);
double tmp;
if (x <= -1650.0) {
tmp = t_1;
} else if (x <= 1.02e-66) {
tmp = t_0;
} else if (x <= 1100.0) {
tmp = (x * t_0) / y;
} else {
tmp = t_1;
}
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 = x / (x + 1.0d0)
t_1 = (1.0d0 + (x / y)) + ((-1.0d0) / y)
if (x <= (-1650.0d0)) then
tmp = t_1
else if (x <= 1.02d-66) then
tmp = t_0
else if (x <= 1100.0d0) then
tmp = (x * t_0) / y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double t_1 = (1.0 + (x / y)) + (-1.0 / y);
double tmp;
if (x <= -1650.0) {
tmp = t_1;
} else if (x <= 1.02e-66) {
tmp = t_0;
} else if (x <= 1100.0) {
tmp = (x * t_0) / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) t_1 = (1.0 + (x / y)) + (-1.0 / y) tmp = 0 if x <= -1650.0: tmp = t_1 elif x <= 1.02e-66: tmp = t_0 elif x <= 1100.0: tmp = (x * t_0) / y else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64(Float64(1.0 + Float64(x / y)) + Float64(-1.0 / y)) tmp = 0.0 if (x <= -1650.0) tmp = t_1; elseif (x <= 1.02e-66) tmp = t_0; elseif (x <= 1100.0) tmp = Float64(Float64(x * t_0) / y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); t_1 = (1.0 + (x / y)) + (-1.0 / y); tmp = 0.0; if (x <= -1650.0) tmp = t_1; elseif (x <= 1.02e-66) tmp = t_0; elseif (x <= 1100.0) tmp = (x * t_0) / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1650.0], t$95$1, If[LessEqual[x, 1.02e-66], t$95$0, If[LessEqual[x, 1100.0], N[(N[(x * t$95$0), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \left(1 + \frac{x}{y}\right) + \frac{-1}{y}\\
\mathbf{if}\;x \leq -1650:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1100:\\
\;\;\;\;\frac{x \cdot t_0}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1650 or 1100 < x Initial program 77.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 99.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.4%
unpow274.4%
+-commutative74.4%
times-frac74.0%
+-commutative74.0%
Simplified74.0%
*-commutative74.0%
associate-*r/74.4%
+-commutative74.4%
Applied egg-rr74.4%
Final simplification88.8%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ (+ 1.0 (/ x y)) (/ -1.0 y)) (+ x (* (* x x) (+ -1.0 (/ 1.0 y))))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (1.0 + (x / y)) + (-1.0 / y);
} else {
tmp = x + ((x * x) * (-1.0 + (1.0 / y)));
}
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.0d0))) then
tmp = (1.0d0 + (x / y)) + ((-1.0d0) / y)
else
tmp = x + ((x * x) * ((-1.0d0) + (1.0d0 / y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (1.0 + (x / y)) + (-1.0 / y);
} else {
tmp = x + ((x * x) * (-1.0 + (1.0 / y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (1.0 + (x / y)) + (-1.0 / y) else: tmp = x + ((x * x) * (-1.0 + (1.0 / y))) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(1.0 + Float64(x / y)) + Float64(-1.0 / y)); else tmp = Float64(x + Float64(Float64(x * x) * Float64(-1.0 + Float64(1.0 / y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (1.0 + (x / y)) + (-1.0 / y); else tmp = x + ((x * x) * (-1.0 + (1.0 / y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(x * x), $MachinePrecision] * N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\left(1 + \frac{x}{y}\right) + \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \left(x \cdot x\right) \cdot \left(-1 + \frac{1}{y}\right)\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 77.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
if -1 < x < 1Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 87.7%
unpow287.7%
sub-neg87.7%
metadata-eval87.7%
Simplified87.7%
Final simplification94.0%
(FPCore (x y)
:precision binary64
(if (<= x -4.9e+101)
(/ x y)
(if (<= x -2.05e+48)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 0.00125) x (if (<= x 1.65e+121) 1.0 (/ x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -4.9e+101) {
tmp = x / y;
} else if (x <= -2.05e+48) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 0.00125) {
tmp = x;
} 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.9d+101)) then
tmp = x / y
else if (x <= (-2.05d+48)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 0.00125d0) then
tmp = x
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.9e+101) {
tmp = x / y;
} else if (x <= -2.05e+48) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 0.00125) {
tmp = x;
} else if (x <= 1.65e+121) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.9e+101: tmp = x / y elif x <= -2.05e+48: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 0.00125: tmp = x elif x <= 1.65e+121: tmp = 1.0 else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -4.9e+101) tmp = Float64(x / y); elseif (x <= -2.05e+48) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 0.00125) tmp = x; 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.9e+101) tmp = x / y; elseif (x <= -2.05e+48) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 0.00125) tmp = x; elseif (x <= 1.65e+121) tmp = 1.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.9e+101], N[(x / y), $MachinePrecision], If[LessEqual[x, -2.05e+48], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 0.00125], x, If[LessEqual[x, 1.65e+121], 1.0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+48}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 0.00125:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+121}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.89999999999999983e101 or -2.0500000000000001e48 < 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.89999999999999983e101 < x < -2.0500000000000001e48 or 0.00125000000000000003 < x < 1.6499999999999999e121Initial program 92.9%
clear-num92.9%
associate-/r/92.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 (+ 1.0 (/ x y))))
(if (<= x -380000.0)
t_0
(if (<= x 1.3e-66)
(/ x (+ x 1.0))
(if (<= x 0.06) (/ 1.0 (/ y (* x x))) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -380000.0) {
tmp = t_0;
} else if (x <= 1.3e-66) {
tmp = x / (x + 1.0);
} else if (x <= 0.06) {
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 = 1.0d0 + (x / y)
if (x <= (-380000.0d0)) then
tmp = t_0
else if (x <= 1.3d-66) then
tmp = x / (x + 1.0d0)
else if (x <= 0.06d0) 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 = 1.0 + (x / y);
double tmp;
if (x <= -380000.0) {
tmp = t_0;
} else if (x <= 1.3e-66) {
tmp = x / (x + 1.0);
} else if (x <= 0.06) {
tmp = 1.0 / (y / (x * x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -380000.0: tmp = t_0 elif x <= 1.3e-66: tmp = x / (x + 1.0) elif x <= 0.06: tmp = 1.0 / (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 <= -380000.0) tmp = t_0; elseif (x <= 1.3e-66) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 0.06) tmp = Float64(1.0 / Float64(y / Float64(x * x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -380000.0) tmp = t_0; elseif (x <= 1.3e-66) tmp = x / (x + 1.0); elseif (x <= 0.06) tmp = 1.0 / (y / (x * x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -380000.0], t$95$0, If[LessEqual[x, 1.3e-66], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.06], N[(1.0 / N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -380000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 0.06:\\
\;\;\;\;\frac{1}{\frac{y}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -3.8e5 or 0.059999999999999998 < x Initial program 77.0%
clear-num76.9%
associate-/r/77.0%
fma-def76.9%
Applied egg-rr76.9%
*-un-lft-identity76.9%
associate-/r*76.9%
fma-udef77.0%
distribute-rgt-in77.0%
associate-*l/77.0%
*-un-lft-identity77.0%
distribute-rgt-in77.0%
+-commutative77.0%
associate-*l/77.0%
associate-/r/77.0%
div-inv76.8%
*-commutative76.8%
associate-/r/76.9%
div-inv76.9%
metadata-eval76.9%
*-rgt-identity76.9%
distribute-lft-in76.9%
*-rgt-identity76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 76.3%
distribute-rgt-in76.3%
rgt-mult-inverse76.4%
metadata-eval76.4%
*-commutative76.4%
associate-*l*99.4%
rgt-mult-inverse99.5%
distribute-rgt-in99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
if -3.8e5 < x < 1.2999999999999999e-66Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.0%
if 1.2999999999999999e-66 < x < 0.059999999999999998Initial 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%
clear-num73.8%
inv-pow73.8%
Applied egg-rr73.8%
unpow-173.8%
Simplified73.8%
Taylor expanded in x around 0 68.3%
unpow268.3%
Simplified68.3%
Final simplification88.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -7600000.0)
t_0
(if (<= x 9e-67)
(/ x (+ x 1.0))
(if (<= x 5.6e+15) (/ x (+ y (/ y x))) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -7600000.0) {
tmp = t_0;
} else if (x <= 9e-67) {
tmp = x / (x + 1.0);
} else if (x <= 5.6e+15) {
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 = 1.0d0 + (x / y)
if (x <= (-7600000.0d0)) then
tmp = t_0
else if (x <= 9d-67) then
tmp = x / (x + 1.0d0)
else if (x <= 5.6d+15) 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 = 1.0 + (x / y);
double tmp;
if (x <= -7600000.0) {
tmp = t_0;
} else if (x <= 9e-67) {
tmp = x / (x + 1.0);
} else if (x <= 5.6e+15) {
tmp = x / (y + (y / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -7600000.0: tmp = t_0 elif x <= 9e-67: tmp = x / (x + 1.0) elif x <= 5.6e+15: tmp = x / (y + (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 <= -7600000.0) tmp = t_0; elseif (x <= 9e-67) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 5.6e+15) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -7600000.0) tmp = t_0; elseif (x <= 9e-67) tmp = x / (x + 1.0); elseif (x <= 5.6e+15) tmp = x / (y + (y / x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7600000.0], t$95$0, If[LessEqual[x, 9e-67], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e+15], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -7600000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -7.6e6 or 5.6e15 < x Initial program 76.8%
clear-num76.7%
associate-/r/76.8%
fma-def76.8%
Applied egg-rr76.8%
*-un-lft-identity76.8%
associate-/r*76.8%
fma-udef76.8%
distribute-rgt-in76.8%
associate-*l/76.8%
*-un-lft-identity76.8%
distribute-rgt-in76.8%
+-commutative76.8%
associate-*l/76.8%
associate-/r/76.8%
div-inv76.7%
*-commutative76.7%
associate-/r/76.7%
div-inv76.7%
metadata-eval76.7%
*-rgt-identity76.7%
distribute-lft-in76.7%
*-rgt-identity76.7%
Applied egg-rr76.7%
Taylor expanded in x around inf 76.2%
distribute-rgt-in76.1%
rgt-mult-inverse76.2%
metadata-eval76.2%
*-commutative76.2%
associate-*l*99.4%
rgt-mult-inverse99.5%
distribute-rgt-in99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
if -7.6e6 < x < 9.00000000000000031e-67Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.0%
if 9.00000000000000031e-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 76.1%
Final simplification88.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -1.0)
t_0
(if (<= x 1.3e-66) x (if (<= x 0.14) (* x (/ x y)) 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.3e-66) {
tmp = x;
} else if (x <= 0.14) {
tmp = x * (x / y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= 1.3d-66) then
tmp = x
else if (x <= 0.14d0) then
tmp = x * (x / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 1.3e-66) {
tmp = x;
} else if (x <= 0.14) {
tmp = x * (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -1.0: tmp = t_0 elif x <= 1.3e-66: tmp = x elif x <= 0.14: tmp = x * (x / y) 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.3e-66) tmp = x; elseif (x <= 0.14) tmp = Float64(x * Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= 1.3e-66) tmp = x; elseif (x <= 0.14) tmp = x * (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 1.3e-66], x, If[LessEqual[x, 0.14], N[(x * N[(x / y), $MachinePrecision]), $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.3 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.14:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1 or 0.14000000000000001 < x Initial program 77.0%
clear-num76.9%
associate-/r/77.0%
fma-def76.9%
Applied egg-rr76.9%
*-un-lft-identity76.9%
associate-/r*76.9%
fma-udef77.0%
distribute-rgt-in77.0%
associate-*l/77.0%
*-un-lft-identity77.0%
distribute-rgt-in77.0%
+-commutative77.0%
associate-*l/77.0%
associate-/r/77.0%
div-inv76.8%
*-commutative76.8%
associate-/r/76.9%
div-inv76.9%
metadata-eval76.9%
*-rgt-identity76.9%
distribute-lft-in76.9%
*-rgt-identity76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 76.3%
distribute-rgt-in76.3%
rgt-mult-inverse76.4%
metadata-eval76.4%
*-commutative76.4%
associate-*l*99.4%
rgt-mult-inverse99.5%
distribute-rgt-in99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
if -1 < x < 1.2999999999999999e-66Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 75.4%
if 1.2999999999999999e-66 < x < 0.14000000000000001Initial 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-/r/68.1%
Applied egg-rr68.1%
Final simplification87.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -390000.0)
t_0
(if (<= x 2.95e-67)
(/ x (+ x 1.0))
(if (<= x 0.014) (* x (/ x y)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -390000.0) {
tmp = t_0;
} else if (x <= 2.95e-67) {
tmp = x / (x + 1.0);
} else if (x <= 0.014) {
tmp = x * (x / y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
if (x <= (-390000.0d0)) then
tmp = t_0
else if (x <= 2.95d-67) then
tmp = x / (x + 1.0d0)
else if (x <= 0.014d0) then
tmp = x * (x / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -390000.0) {
tmp = t_0;
} else if (x <= 2.95e-67) {
tmp = x / (x + 1.0);
} else if (x <= 0.014) {
tmp = x * (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -390000.0: tmp = t_0 elif x <= 2.95e-67: tmp = x / (x + 1.0) elif x <= 0.014: tmp = x * (x / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (x <= -390000.0) tmp = t_0; elseif (x <= 2.95e-67) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 0.014) tmp = Float64(x * Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -390000.0) tmp = t_0; elseif (x <= 2.95e-67) tmp = x / (x + 1.0); elseif (x <= 0.014) tmp = x * (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -390000.0], t$95$0, If[LessEqual[x, 2.95e-67], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.014], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -390000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.95 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 0.014:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -3.9e5 or 0.0140000000000000003 < x Initial program 77.0%
clear-num76.9%
associate-/r/77.0%
fma-def76.9%
Applied egg-rr76.9%
*-un-lft-identity76.9%
associate-/r*76.9%
fma-udef77.0%
distribute-rgt-in77.0%
associate-*l/77.0%
*-un-lft-identity77.0%
distribute-rgt-in77.0%
+-commutative77.0%
associate-*l/77.0%
associate-/r/77.0%
div-inv76.8%
*-commutative76.8%
associate-/r/76.9%
div-inv76.9%
metadata-eval76.9%
*-rgt-identity76.9%
distribute-lft-in76.9%
*-rgt-identity76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 76.3%
distribute-rgt-in76.3%
rgt-mult-inverse76.4%
metadata-eval76.4%
*-commutative76.4%
associate-*l*99.4%
rgt-mult-inverse99.5%
distribute-rgt-in99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
if -3.9e5 < x < 2.95e-67Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.0%
if 2.95e-67 < x < 0.0140000000000000003Initial 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-/r/68.1%
Applied egg-rr68.1%
Final simplification88.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= x -2100000.0)
t_0
(if (<= x 1.3e-66) (/ x (+ x 1.0)) (if (<= x 0.036) (/ x (/ y x)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -2100000.0) {
tmp = t_0;
} else if (x <= 1.3e-66) {
tmp = x / (x + 1.0);
} else if (x <= 0.036) {
tmp = x / (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 = 1.0d0 + (x / y)
if (x <= (-2100000.0d0)) then
tmp = t_0
else if (x <= 1.3d-66) then
tmp = x / (x + 1.0d0)
else if (x <= 0.036d0) then
tmp = x / (y / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (x <= -2100000.0) {
tmp = t_0;
} else if (x <= 1.3e-66) {
tmp = x / (x + 1.0);
} else if (x <= 0.036) {
tmp = x / (y / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if x <= -2100000.0: tmp = t_0 elif x <= 1.3e-66: tmp = x / (x + 1.0) elif x <= 0.036: tmp = 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 <= -2100000.0) tmp = t_0; elseif (x <= 1.3e-66) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 0.036) tmp = Float64(x / Float64(y / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); tmp = 0.0; if (x <= -2100000.0) tmp = t_0; elseif (x <= 1.3e-66) tmp = x / (x + 1.0); elseif (x <= 0.036) tmp = x / (y / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2100000.0], t$95$0, If[LessEqual[x, 1.3e-66], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.036], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;x \leq -2100000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 0.036:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.1e6 or 0.0359999999999999973 < x Initial program 77.0%
clear-num76.9%
associate-/r/77.0%
fma-def76.9%
Applied egg-rr76.9%
*-un-lft-identity76.9%
associate-/r*76.9%
fma-udef77.0%
distribute-rgt-in77.0%
associate-*l/77.0%
*-un-lft-identity77.0%
distribute-rgt-in77.0%
+-commutative77.0%
associate-*l/77.0%
associate-/r/77.0%
div-inv76.8%
*-commutative76.8%
associate-/r/76.9%
div-inv76.9%
metadata-eval76.9%
*-rgt-identity76.9%
distribute-lft-in76.9%
*-rgt-identity76.9%
Applied egg-rr76.9%
Taylor expanded in x around inf 76.3%
distribute-rgt-in76.3%
rgt-mult-inverse76.4%
metadata-eval76.4%
*-commutative76.4%
associate-*l*99.4%
rgt-mult-inverse99.5%
distribute-rgt-in99.5%
*-un-lft-identity99.5%
+-commutative99.5%
Applied egg-rr99.5%
if -2.1e6 < x < 1.2999999999999999e-66Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.0%
if 1.2999999999999999e-66 < x < 0.0359999999999999973Initial 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%
Final simplification88.3%
(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%
clear-num76.8%
associate-/r/76.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%
clear-num87.9%
associate-/r/87.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)))