
(FPCore (x y) :precision binary64 (/ (+ x y) (+ y 1.0)))
double code(double x, double y) {
return (x + y) / (y + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (y + 1.0d0)
end function
public static double code(double x, double y) {
return (x + y) / (y + 1.0);
}
def code(x, y): return (x + y) / (y + 1.0)
function code(x, y) return Float64(Float64(x + y) / Float64(y + 1.0)) end
function tmp = code(x, y) tmp = (x + y) / (y + 1.0); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{y + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (+ x y) (+ y 1.0)))
double code(double x, double y) {
return (x + y) / (y + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (y + 1.0d0)
end function
public static double code(double x, double y) {
return (x + y) / (y + 1.0);
}
def code(x, y): return (x + y) / (y + 1.0)
function code(x, y) return Float64(Float64(x + y) / Float64(y + 1.0)) end
function tmp = code(x, y) tmp = (x + y) / (y + 1.0); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{y + 1}
\end{array}
(FPCore (x y) :precision binary64 (+ (/ y (+ y 1.0)) (/ x (+ y 1.0))))
double code(double x, double y) {
return (y / (y + 1.0)) + (x / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y / (y + 1.0d0)) + (x / (y + 1.0d0))
end function
public static double code(double x, double y) {
return (y / (y + 1.0)) + (x / (y + 1.0));
}
def code(x, y): return (y / (y + 1.0)) + (x / (y + 1.0))
function code(x, y) return Float64(Float64(y / Float64(y + 1.0)) + Float64(x / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = (y / (y + 1.0)) + (x / (y + 1.0)); end
code[x_, y_] := N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{y + 1} + \frac{x}{y + 1}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ x (+ y 1.0))))
(if (<= y -70000000.0)
t_0
(if (<= y -8.5e-43)
t_1
(if (<= y -1.6e-110) (/ y (+ y 1.0)) (if (<= y 27000000.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x / (y + 1.0);
double tmp;
if (y <= -70000000.0) {
tmp = t_0;
} else if (y <= -8.5e-43) {
tmp = t_1;
} else if (y <= -1.6e-110) {
tmp = y / (y + 1.0);
} else if (y <= 27000000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
t_1 = x / (y + 1.0d0)
if (y <= (-70000000.0d0)) then
tmp = t_0
else if (y <= (-8.5d-43)) then
tmp = t_1
else if (y <= (-1.6d-110)) then
tmp = y / (y + 1.0d0)
else if (y <= 27000000.0d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x / (y + 1.0);
double tmp;
if (y <= -70000000.0) {
tmp = t_0;
} else if (y <= -8.5e-43) {
tmp = t_1;
} else if (y <= -1.6e-110) {
tmp = y / (y + 1.0);
} else if (y <= 27000000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = x / (y + 1.0) tmp = 0 if y <= -70000000.0: tmp = t_0 elif y <= -8.5e-43: tmp = t_1 elif y <= -1.6e-110: tmp = y / (y + 1.0) elif y <= 27000000.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) t_1 = Float64(x / Float64(y + 1.0)) tmp = 0.0 if (y <= -70000000.0) tmp = t_0; elseif (y <= -8.5e-43) tmp = t_1; elseif (y <= -1.6e-110) tmp = Float64(y / Float64(y + 1.0)); elseif (y <= 27000000.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); t_1 = x / (y + 1.0); tmp = 0.0; if (y <= -70000000.0) tmp = t_0; elseif (y <= -8.5e-43) tmp = t_1; elseif (y <= -1.6e-110) tmp = y / (y + 1.0); elseif (y <= 27000000.0) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -70000000.0], t$95$0, If[LessEqual[y, -8.5e-43], t$95$1, If[LessEqual[y, -1.6e-110], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 27000000.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := \frac{x}{y + 1}\\
\mathbf{if}\;y \leq -70000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-110}:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 27000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7e7 or 2.7e7 < y Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 99.6%
Taylor expanded in y around inf 99.0%
if -7e7 < y < -8.50000000000000056e-43 or -1.60000000000000014e-110 < y < 2.7e7Initial program 100.0%
Taylor expanded in x around inf 76.7%
+-commutative76.7%
Simplified76.7%
if -8.50000000000000056e-43 < y < -1.60000000000000014e-110Initial program 100.0%
Taylor expanded in x around 0 74.6%
+-commutative74.6%
Simplified74.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ x (+ y 1.0))))
(if (<= y -1100000.0)
t_0
(if (<= y -5.5e-43)
t_1
(if (<= y -1.6e-110) y (if (<= y 30000000.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x / (y + 1.0);
double tmp;
if (y <= -1100000.0) {
tmp = t_0;
} else if (y <= -5.5e-43) {
tmp = t_1;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 30000000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
t_1 = x / (y + 1.0d0)
if (y <= (-1100000.0d0)) then
tmp = t_0
else if (y <= (-5.5d-43)) then
tmp = t_1
else if (y <= (-1.6d-110)) then
tmp = y
else if (y <= 30000000.0d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x / (y + 1.0);
double tmp;
if (y <= -1100000.0) {
tmp = t_0;
} else if (y <= -5.5e-43) {
tmp = t_1;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 30000000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = x / (y + 1.0) tmp = 0 if y <= -1100000.0: tmp = t_0 elif y <= -5.5e-43: tmp = t_1 elif y <= -1.6e-110: tmp = y elif y <= 30000000.0: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) t_1 = Float64(x / Float64(y + 1.0)) tmp = 0.0 if (y <= -1100000.0) tmp = t_0; elseif (y <= -5.5e-43) tmp = t_1; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 30000000.0) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); t_1 = x / (y + 1.0); tmp = 0.0; if (y <= -1100000.0) tmp = t_0; elseif (y <= -5.5e-43) tmp = t_1; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 30000000.0) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1100000.0], t$95$0, If[LessEqual[y, -5.5e-43], t$95$1, If[LessEqual[y, -1.6e-110], y, If[LessEqual[y, 30000000.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := \frac{x}{y + 1}\\
\mathbf{if}\;y \leq -1100000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-110}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 30000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.1e6 or 3e7 < y Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 99.6%
Taylor expanded in y around inf 99.0%
if -1.1e6 < y < -5.50000000000000013e-43 or -1.60000000000000014e-110 < y < 3e7Initial program 100.0%
Taylor expanded in x around inf 76.7%
+-commutative76.7%
Simplified76.7%
if -5.50000000000000013e-43 < y < -1.60000000000000014e-110Initial program 100.0%
Taylor expanded in x around 0 74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in y around 0 74.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (- x (* y x))))
(if (<= y -1.0)
t_0
(if (<= y -2.4e-42)
t_1
(if (<= y -1.6e-110) y (if (<= y 0.08) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x - (y * x);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -2.4e-42) {
tmp = t_1;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 0.08) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / y)
t_1 = x - (y * x)
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-2.4d-42)) then
tmp = t_1
else if (y <= (-1.6d-110)) then
tmp = y
else if (y <= 0.08d0) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = x - (y * x);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -2.4e-42) {
tmp = t_1;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 0.08) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = x - (y * x) tmp = 0 if y <= -1.0: tmp = t_0 elif y <= -2.4e-42: tmp = t_1 elif y <= -1.6e-110: tmp = y elif y <= 0.08: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) t_1 = Float64(x - Float64(y * x)) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= -2.4e-42) tmp = t_1; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 0.08) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (x / y); t_1 = x - (y * x); tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= -2.4e-42) tmp = t_1; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 0.08) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, -2.4e-42], t$95$1, If[LessEqual[y, -1.6e-110], y, If[LessEqual[y, 0.08], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := x - y \cdot x\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-110}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 0.08:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 0.0800000000000000017 < y Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 99.1%
Taylor expanded in y around inf 97.3%
if -1 < y < -2.40000000000000003e-42 or -1.60000000000000014e-110 < y < 0.0800000000000000017Initial program 100.0%
Taylor expanded in x around inf 76.7%
+-commutative76.7%
Simplified76.7%
Taylor expanded in y around 0 76.4%
associate-*r*76.4%
neg-mul-176.4%
Simplified76.4%
distribute-lft-neg-out76.4%
unsub-neg76.4%
*-commutative76.4%
Applied egg-rr76.4%
if -2.40000000000000003e-42 < y < -1.60000000000000014e-110Initial program 100.0%
Taylor expanded in x around 0 74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in y around 0 74.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= y -1.0)
t_0
(if (<= y -1.3e-41) x (if (<= y -1.6e-110) y (if (<= y 0.0135) x t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -1.3e-41) {
tmp = x;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 0.0135) {
tmp = 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 (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-1.3d-41)) then
tmp = x
else if (y <= (-1.6d-110)) then
tmp = y
else if (y <= 0.0135d0) then
tmp = 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 (y <= -1.0) {
tmp = t_0;
} else if (y <= -1.3e-41) {
tmp = x;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 0.0135) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) tmp = 0 if y <= -1.0: tmp = t_0 elif y <= -1.3e-41: tmp = x elif y <= -1.6e-110: tmp = y elif y <= 0.0135: tmp = x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(x / y)) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= -1.3e-41) tmp = x; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 0.0135) tmp = 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 (y <= -1.0) tmp = t_0; elseif (y <= -1.3e-41) tmp = x; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 0.0135) tmp = 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[y, -1.0], t$95$0, If[LessEqual[y, -1.3e-41], x, If[LessEqual[y, -1.6e-110], y, If[LessEqual[y, 0.0135], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-110}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 0.0135:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 0.0134999999999999998 < y Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 99.1%
Taylor expanded in y around inf 97.3%
if -1 < y < -1.3e-41 or -1.60000000000000014e-110 < y < 0.0134999999999999998Initial program 100.0%
Taylor expanded in y around 0 75.4%
if -1.3e-41 < y < -1.60000000000000014e-110Initial program 100.0%
Taylor expanded in x around 0 74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in y around 0 74.6%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
1.0
(if (<= y -3.5e-43)
x
(if (<= y -1.6e-110) y (if (<= y 27000000.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -3.5e-43) {
tmp = x;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 27000000.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 (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= (-3.5d-43)) then
tmp = x
else if (y <= (-1.6d-110)) then
tmp = y
else if (y <= 27000000.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 (y <= -1.0) {
tmp = 1.0;
} else if (y <= -3.5e-43) {
tmp = x;
} else if (y <= -1.6e-110) {
tmp = y;
} else if (y <= 27000000.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= -3.5e-43: tmp = x elif y <= -1.6e-110: tmp = y elif y <= 27000000.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= -3.5e-43) tmp = x; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 27000000.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0; elseif (y <= -3.5e-43) tmp = x; elseif (y <= -1.6e-110) tmp = y; elseif (y <= 27000000.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, -3.5e-43], x, If[LessEqual[y, -1.6e-110], y, If[LessEqual[y, 27000000.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-43}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-110}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 27000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 2.7e7 < y Initial program 100.0%
Taylor expanded in y around inf 72.1%
if -1 < y < -3.49999999999999997e-43 or -1.60000000000000014e-110 < y < 2.7e7Initial program 100.0%
Taylor expanded in y around 0 74.8%
if -3.49999999999999997e-43 < y < -1.60000000000000014e-110Initial program 100.0%
Taylor expanded in x around 0 74.6%
+-commutative74.6%
Simplified74.6%
Taylor expanded in y around 0 74.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.9e-5) (not (<= y 3.15e-6))) (+ 1.0 (/ x (+ y 1.0))) (+ x (* y (- 1.0 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.9e-5) || !(y <= 3.15e-6)) {
tmp = 1.0 + (x / (y + 1.0));
} else {
tmp = x + (y * (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 ((y <= (-1.9d-5)) .or. (.not. (y <= 3.15d-6))) then
tmp = 1.0d0 + (x / (y + 1.0d0))
else
tmp = x + (y * (1.0d0 - x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.9e-5) || !(y <= 3.15e-6)) {
tmp = 1.0 + (x / (y + 1.0));
} else {
tmp = x + (y * (1.0 - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.9e-5) or not (y <= 3.15e-6): tmp = 1.0 + (x / (y + 1.0)) else: tmp = x + (y * (1.0 - x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.9e-5) || !(y <= 3.15e-6)) tmp = Float64(1.0 + Float64(x / Float64(y + 1.0))); else tmp = Float64(x + Float64(y * Float64(1.0 - x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.9e-5) || ~((y <= 3.15e-6))) tmp = 1.0 + (x / (y + 1.0)); else tmp = x + (y * (1.0 - x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.9e-5], N[Not[LessEqual[y, 3.15e-6]], $MachinePrecision]], N[(1.0 + N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-5} \lor \neg \left(y \leq 3.15 \cdot 10^{-6}\right):\\
\;\;\;\;1 + \frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - x\right)\\
\end{array}
\end{array}
if y < -1.9000000000000001e-5 or 3.14999999999999991e-6 < y Initial program 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 99.1%
if -1.9000000000000001e-5 < y < 3.14999999999999991e-6Initial program 100.0%
Taylor expanded in y around 0 99.2%
Final simplification99.2%
(FPCore (x y) :precision binary64 (if (or (<= x -500000.0) (not (<= x 3.4e-69))) (+ 1.0 (/ x (+ y 1.0))) (/ y (+ y 1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -500000.0) || !(x <= 3.4e-69)) {
tmp = 1.0 + (x / (y + 1.0));
} else {
tmp = y / (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 <= (-500000.0d0)) .or. (.not. (x <= 3.4d-69))) then
tmp = 1.0d0 + (x / (y + 1.0d0))
else
tmp = y / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -500000.0) || !(x <= 3.4e-69)) {
tmp = 1.0 + (x / (y + 1.0));
} else {
tmp = y / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -500000.0) or not (x <= 3.4e-69): tmp = 1.0 + (x / (y + 1.0)) else: tmp = y / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -500000.0) || !(x <= 3.4e-69)) tmp = Float64(1.0 + Float64(x / Float64(y + 1.0))); else tmp = Float64(y / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -500000.0) || ~((x <= 3.4e-69))) tmp = 1.0 + (x / (y + 1.0)); else tmp = y / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -500000.0], N[Not[LessEqual[x, 3.4e-69]], $MachinePrecision]], N[(1.0 + N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -500000 \lor \neg \left(x \leq 3.4 \cdot 10^{-69}\right):\\
\;\;\;\;1 + \frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + 1}\\
\end{array}
\end{array}
if x < -5e5 or 3.40000000000000008e-69 < x Initial program 99.9%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 95.0%
if -5e5 < x < 3.40000000000000008e-69Initial program 100.0%
Taylor expanded in x around 0 85.0%
+-commutative85.0%
Simplified85.0%
Final simplification90.6%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 27000000.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 27000000.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 (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= 27000000.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 (y <= -1.0) {
tmp = 1.0;
} else if (y <= 27000000.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 27000000.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 27000000.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0; elseif (y <= 27000000.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 27000000.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 27000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 2.7e7 < y Initial program 100.0%
Taylor expanded in y around inf 72.1%
if -1 < y < 2.7e7Initial program 100.0%
Taylor expanded in y around 0 67.6%
(FPCore (x y) :precision binary64 (/ (+ y x) (+ y 1.0)))
double code(double x, double y) {
return (y + x) / (y + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y + x) / (y + 1.0d0)
end function
public static double code(double x, double y) {
return (y + x) / (y + 1.0);
}
def code(x, y): return (y + x) / (y + 1.0)
function code(x, y) return Float64(Float64(y + x) / Float64(y + 1.0)) end
function tmp = code(x, y) tmp = (y + x) / (y + 1.0); end
code[x_, y_] := N[(N[(y + x), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y + x}{y + 1}
\end{array}
Initial program 100.0%
Final simplification100.0%
(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 100.0%
Taylor expanded in y around inf 40.3%
herbie shell --seed 2024110
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))