
(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 9 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 (/ (+ 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}
Initial program 100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.1)
1.0
(if (<= y -2.6e-117)
y
(if (<= y 1.75e-77)
x
(if (<= y 8500.0) y (if (<= y 7.4e+68) (/ x y) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -1.1) {
tmp = 1.0;
} else if (y <= -2.6e-117) {
tmp = y;
} else if (y <= 1.75e-77) {
tmp = x;
} else if (y <= 8500.0) {
tmp = y;
} else if (y <= 7.4e+68) {
tmp = x / y;
} 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.1d0)) then
tmp = 1.0d0
else if (y <= (-2.6d-117)) then
tmp = y
else if (y <= 1.75d-77) then
tmp = x
else if (y <= 8500.0d0) then
tmp = y
else if (y <= 7.4d+68) then
tmp = x / y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.1) {
tmp = 1.0;
} else if (y <= -2.6e-117) {
tmp = y;
} else if (y <= 1.75e-77) {
tmp = x;
} else if (y <= 8500.0) {
tmp = y;
} else if (y <= 7.4e+68) {
tmp = x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.1: tmp = 1.0 elif y <= -2.6e-117: tmp = y elif y <= 1.75e-77: tmp = x elif y <= 8500.0: tmp = y elif y <= 7.4e+68: tmp = x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.1) tmp = 1.0; elseif (y <= -2.6e-117) tmp = y; elseif (y <= 1.75e-77) tmp = x; elseif (y <= 8500.0) tmp = y; elseif (y <= 7.4e+68) tmp = Float64(x / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.1) tmp = 1.0; elseif (y <= -2.6e-117) tmp = y; elseif (y <= 1.75e-77) tmp = x; elseif (y <= 8500.0) tmp = y; elseif (y <= 7.4e+68) tmp = x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.1], 1.0, If[LessEqual[y, -2.6e-117], y, If[LessEqual[y, 1.75e-77], x, If[LessEqual[y, 8500.0], y, If[LessEqual[y, 7.4e+68], N[(x / y), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-117}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-77}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8500:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+68}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.1000000000000001 or 7.39999999999999996e68 < y Initial program 100.0%
Taylor expanded in y around inf 80.1%
if -1.1000000000000001 < y < -2.59999999999999983e-117 or 1.75000000000000006e-77 < y < 8500Initial program 99.9%
Taylor expanded in x around 0 68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in y around 0 63.2%
if -2.59999999999999983e-117 < y < 1.75000000000000006e-77Initial program 100.0%
Taylor expanded in y around 0 83.9%
if 8500 < y < 7.39999999999999996e68Initial program 100.0%
Taylor expanded in x around inf 76.0%
+-commutative76.0%
Simplified76.0%
Taylor expanded in y around inf 64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y 1.0))))
(if (<= y -3.2e-117)
t_0
(if (<= y 8.5e-77)
x
(if (<= y 106000.0) t_0 (if (<= y 3.05e+68) (/ x (+ y 1.0)) 1.0))))))
double code(double x, double y) {
double t_0 = y / (y + 1.0);
double tmp;
if (y <= -3.2e-117) {
tmp = t_0;
} else if (y <= 8.5e-77) {
tmp = x;
} else if (y <= 106000.0) {
tmp = t_0;
} else if (y <= 3.05e+68) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (y + 1.0d0)
if (y <= (-3.2d-117)) then
tmp = t_0
else if (y <= 8.5d-77) then
tmp = x
else if (y <= 106000.0d0) then
tmp = t_0
else if (y <= 3.05d+68) then
tmp = x / (y + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y + 1.0);
double tmp;
if (y <= -3.2e-117) {
tmp = t_0;
} else if (y <= 8.5e-77) {
tmp = x;
} else if (y <= 106000.0) {
tmp = t_0;
} else if (y <= 3.05e+68) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = y / (y + 1.0) tmp = 0 if y <= -3.2e-117: tmp = t_0 elif y <= 8.5e-77: tmp = x elif y <= 106000.0: tmp = t_0 elif y <= 3.05e+68: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(y / Float64(y + 1.0)) tmp = 0.0 if (y <= -3.2e-117) tmp = t_0; elseif (y <= 8.5e-77) tmp = x; elseif (y <= 106000.0) tmp = t_0; elseif (y <= 3.05e+68) tmp = Float64(x / Float64(y + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y + 1.0); tmp = 0.0; if (y <= -3.2e-117) tmp = t_0; elseif (y <= 8.5e-77) tmp = x; elseif (y <= 106000.0) tmp = t_0; elseif (y <= 3.05e+68) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.2e-117], t$95$0, If[LessEqual[y, 8.5e-77], x, If[LessEqual[y, 106000.0], t$95$0, If[LessEqual[y, 3.05e+68], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y + 1}\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{-117}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-77}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 106000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{+68}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.19999999999999995e-117 or 8.4999999999999998e-77 < y < 106000Initial program 100.0%
Taylor expanded in x around 0 76.1%
+-commutative76.1%
Simplified76.1%
if -3.19999999999999995e-117 < y < 8.4999999999999998e-77Initial program 100.0%
Taylor expanded in y around 0 83.9%
if 106000 < y < 3.05e68Initial program 100.0%
Taylor expanded in x around inf 76.0%
+-commutative76.0%
Simplified76.0%
if 3.05e68 < y Initial program 100.0%
Taylor expanded in y around inf 82.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ y 1.0))))
(if (<= y -3e+82)
1.0
(if (<= y 8.5e-77)
t_0
(if (<= y 2.3e-22) y (if (<= y 3.7e+67) t_0 1.0))))))
double code(double x, double y) {
double t_0 = x / (y + 1.0);
double tmp;
if (y <= -3e+82) {
tmp = 1.0;
} else if (y <= 8.5e-77) {
tmp = t_0;
} else if (y <= 2.3e-22) {
tmp = y;
} else if (y <= 3.7e+67) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y + 1.0d0)
if (y <= (-3d+82)) then
tmp = 1.0d0
else if (y <= 8.5d-77) then
tmp = t_0
else if (y <= 2.3d-22) then
tmp = y
else if (y <= 3.7d+67) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y + 1.0);
double tmp;
if (y <= -3e+82) {
tmp = 1.0;
} else if (y <= 8.5e-77) {
tmp = t_0;
} else if (y <= 2.3e-22) {
tmp = y;
} else if (y <= 3.7e+67) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (y + 1.0) tmp = 0 if y <= -3e+82: tmp = 1.0 elif y <= 8.5e-77: tmp = t_0 elif y <= 2.3e-22: tmp = y elif y <= 3.7e+67: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y + 1.0)) tmp = 0.0 if (y <= -3e+82) tmp = 1.0; elseif (y <= 8.5e-77) tmp = t_0; elseif (y <= 2.3e-22) tmp = y; elseif (y <= 3.7e+67) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y + 1.0); tmp = 0.0; if (y <= -3e+82) tmp = 1.0; elseif (y <= 8.5e-77) tmp = t_0; elseif (y <= 2.3e-22) tmp = y; elseif (y <= 3.7e+67) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3e+82], 1.0, If[LessEqual[y, 8.5e-77], t$95$0, If[LessEqual[y, 2.3e-22], y, If[LessEqual[y, 3.7e+67], t$95$0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y + 1}\\
\mathbf{if}\;y \leq -3 \cdot 10^{+82}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-22}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.99999999999999989e82 or 3.6999999999999997e67 < y Initial program 100.0%
Taylor expanded in y around inf 85.6%
if -2.99999999999999989e82 < y < 8.4999999999999998e-77 or 2.2999999999999998e-22 < y < 3.6999999999999997e67Initial program 100.0%
Taylor expanded in x around inf 72.6%
+-commutative72.6%
Simplified72.6%
if 8.4999999999999998e-77 < y < 2.2999999999999998e-22Initial program 100.0%
Taylor expanded in x around 0 85.0%
+-commutative85.0%
Simplified85.0%
Taylor expanded in y around 0 85.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= y -54000.0)
t_0
(if (<= y 3.3e-77)
(/ x (+ y 1.0))
(if (<= y 15500.0) (/ 1.0 (+ 1.0 (/ 1.0 y))) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (y <= -54000.0) {
tmp = t_0;
} else if (y <= 3.3e-77) {
tmp = x / (y + 1.0);
} else if (y <= 15500.0) {
tmp = 1.0 / (1.0 + (1.0 / 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 + (-1.0d0)) / y)
if (y <= (-54000.0d0)) then
tmp = t_0
else if (y <= 3.3d-77) then
tmp = x / (y + 1.0d0)
else if (y <= 15500.0d0) then
tmp = 1.0d0 / (1.0d0 + (1.0d0 / 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 + -1.0) / y);
double tmp;
if (y <= -54000.0) {
tmp = t_0;
} else if (y <= 3.3e-77) {
tmp = x / (y + 1.0);
} else if (y <= 15500.0) {
tmp = 1.0 / (1.0 + (1.0 / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) tmp = 0 if y <= -54000.0: tmp = t_0 elif y <= 3.3e-77: tmp = x / (y + 1.0) elif y <= 15500.0: tmp = 1.0 / (1.0 + (1.0 / y)) 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 (y <= -54000.0) tmp = t_0; elseif (y <= 3.3e-77) tmp = Float64(x / Float64(y + 1.0)); elseif (y <= 15500.0) tmp = Float64(1.0 / Float64(1.0 + Float64(1.0 / y))); 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 (y <= -54000.0) tmp = t_0; elseif (y <= 3.3e-77) tmp = x / (y + 1.0); elseif (y <= 15500.0) tmp = 1.0 / (1.0 + (1.0 / y)); 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[y, -54000.0], t$95$0, If[LessEqual[y, 3.3e-77], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 15500.0], N[(1.0 / N[(1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;y \leq -54000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-77}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 15500:\\
\;\;\;\;\frac{1}{1 + \frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -54000 or 15500 < y Initial program 100.0%
Taylor expanded in y around inf 98.2%
associate--l+98.2%
div-sub98.2%
sub-neg98.2%
metadata-eval98.2%
Simplified98.2%
if -54000 < y < 3.29999999999999991e-77Initial program 100.0%
Taylor expanded in x around inf 76.7%
+-commutative76.7%
Simplified76.7%
if 3.29999999999999991e-77 < y < 15500Initial program 99.8%
clear-num99.7%
inv-pow99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 78.0%
associate--l+78.0%
div-sub78.0%
Simplified78.0%
Taylor expanded in x around 0 78.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= y -4500.0)
t_0
(if (<= y 5.3e-77)
(/ x (+ y 1.0))
(if (<= y 23000.0) (/ y (+ y 1.0)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (y <= -4500.0) {
tmp = t_0;
} else if (y <= 5.3e-77) {
tmp = x / (y + 1.0);
} else if (y <= 23000.0) {
tmp = y / (y + 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 (y <= (-4500.0d0)) then
tmp = t_0
else if (y <= 5.3d-77) then
tmp = x / (y + 1.0d0)
else if (y <= 23000.0d0) then
tmp = y / (y + 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 (y <= -4500.0) {
tmp = t_0;
} else if (y <= 5.3e-77) {
tmp = x / (y + 1.0);
} else if (y <= 23000.0) {
tmp = y / (y + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) tmp = 0 if y <= -4500.0: tmp = t_0 elif y <= 5.3e-77: tmp = x / (y + 1.0) elif y <= 23000.0: tmp = y / (y + 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 (y <= -4500.0) tmp = t_0; elseif (y <= 5.3e-77) tmp = Float64(x / Float64(y + 1.0)); elseif (y <= 23000.0) tmp = Float64(y / Float64(y + 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 (y <= -4500.0) tmp = t_0; elseif (y <= 5.3e-77) tmp = x / (y + 1.0); elseif (y <= 23000.0) tmp = y / (y + 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[y, -4500.0], t$95$0, If[LessEqual[y, 5.3e-77], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 23000.0], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;y \leq -4500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{-77}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 23000:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4500 or 23000 < y Initial program 100.0%
Taylor expanded in y around inf 98.2%
associate--l+98.2%
div-sub98.2%
sub-neg98.2%
metadata-eval98.2%
Simplified98.2%
if -4500 < y < 5.30000000000000015e-77Initial program 100.0%
Taylor expanded in x around inf 76.7%
+-commutative76.7%
Simplified76.7%
if 5.30000000000000015e-77 < y < 23000Initial program 99.8%
Taylor expanded in x around 0 78.0%
+-commutative78.0%
Simplified78.0%
(FPCore (x y) :precision binary64 (if (<= y -1.1) 1.0 (if (<= y -3.2e-117) y (if (<= y 1.45e-77) x (if (<= y 1.0) y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.1) {
tmp = 1.0;
} else if (y <= -3.2e-117) {
tmp = y;
} else if (y <= 1.45e-77) {
tmp = x;
} else if (y <= 1.0) {
tmp = y;
} 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.1d0)) then
tmp = 1.0d0
else if (y <= (-3.2d-117)) then
tmp = y
else if (y <= 1.45d-77) then
tmp = x
else if (y <= 1.0d0) then
tmp = y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.1) {
tmp = 1.0;
} else if (y <= -3.2e-117) {
tmp = y;
} else if (y <= 1.45e-77) {
tmp = x;
} else if (y <= 1.0) {
tmp = y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.1: tmp = 1.0 elif y <= -3.2e-117: tmp = y elif y <= 1.45e-77: tmp = x elif y <= 1.0: tmp = y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.1) tmp = 1.0; elseif (y <= -3.2e-117) tmp = y; elseif (y <= 1.45e-77) tmp = x; elseif (y <= 1.0) tmp = y; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.1) tmp = 1.0; elseif (y <= -3.2e-117) tmp = y; elseif (y <= 1.45e-77) tmp = x; elseif (y <= 1.0) tmp = y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.1], 1.0, If[LessEqual[y, -3.2e-117], y, If[LessEqual[y, 1.45e-77], x, If[LessEqual[y, 1.0], y, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-117}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-77}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.1000000000000001 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 73.1%
if -1.1000000000000001 < y < -3.19999999999999995e-117 or 1.4499999999999999e-77 < y < 1Initial program 99.9%
Taylor expanded in x around 0 67.3%
+-commutative67.3%
Simplified67.3%
Taylor expanded in y around 0 64.6%
if -3.19999999999999995e-117 < y < 1.4499999999999999e-77Initial program 100.0%
Taylor expanded in y around 0 83.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 2.25e+24) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 2.25e+24) {
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 <= 2.25d+24) 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 <= 2.25e+24) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 2.25e+24: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 2.25e+24) 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 <= 2.25e+24) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 2.25e+24], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 2.2500000000000001e24 < y Initial program 100.0%
Taylor expanded in y around inf 77.5%
if -1 < y < 2.2500000000000001e24Initial program 100.0%
Taylor expanded in y around 0 65.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 100.0%
Taylor expanded in y around inf 38.4%
herbie shell --seed 2024091
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))