
(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
(let* ((t_0 (/ y (+ y 1.0))))
(if (<= y -2000000.0)
(+ 1.0 (/ x y))
(if (<= y -5.8e-98)
t_0
(if (<= y 2.75e-19) x (if (<= y 280000.0) t_0 (/ (+ x y) y)))))))
double code(double x, double y) {
double t_0 = y / (y + 1.0);
double tmp;
if (y <= -2000000.0) {
tmp = 1.0 + (x / y);
} else if (y <= -5.8e-98) {
tmp = t_0;
} else if (y <= 2.75e-19) {
tmp = x;
} else if (y <= 280000.0) {
tmp = t_0;
} else {
tmp = (x + y) / 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 = y / (y + 1.0d0)
if (y <= (-2000000.0d0)) then
tmp = 1.0d0 + (x / y)
else if (y <= (-5.8d-98)) then
tmp = t_0
else if (y <= 2.75d-19) then
tmp = x
else if (y <= 280000.0d0) then
tmp = t_0
else
tmp = (x + y) / y
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 <= -2000000.0) {
tmp = 1.0 + (x / y);
} else if (y <= -5.8e-98) {
tmp = t_0;
} else if (y <= 2.75e-19) {
tmp = x;
} else if (y <= 280000.0) {
tmp = t_0;
} else {
tmp = (x + y) / y;
}
return tmp;
}
def code(x, y): t_0 = y / (y + 1.0) tmp = 0 if y <= -2000000.0: tmp = 1.0 + (x / y) elif y <= -5.8e-98: tmp = t_0 elif y <= 2.75e-19: tmp = x elif y <= 280000.0: tmp = t_0 else: tmp = (x + y) / y return tmp
function code(x, y) t_0 = Float64(y / Float64(y + 1.0)) tmp = 0.0 if (y <= -2000000.0) tmp = Float64(1.0 + Float64(x / y)); elseif (y <= -5.8e-98) tmp = t_0; elseif (y <= 2.75e-19) tmp = x; elseif (y <= 280000.0) tmp = t_0; else tmp = Float64(Float64(x + y) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y + 1.0); tmp = 0.0; if (y <= -2000000.0) tmp = 1.0 + (x / y); elseif (y <= -5.8e-98) tmp = t_0; elseif (y <= 2.75e-19) tmp = x; elseif (y <= 280000.0) tmp = t_0; else tmp = (x + y) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2000000.0], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.8e-98], t$95$0, If[LessEqual[y, 2.75e-19], x, If[LessEqual[y, 280000.0], t$95$0, N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y + 1}\\
\mathbf{if}\;y \leq -2000000:\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-98}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 280000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{y}\\
\end{array}
\end{array}
if y < -2e6Initial program 99.9%
Taylor expanded in y around inf 98.9%
associate--l+98.9%
div-sub98.9%
sub-neg98.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
if -2e6 < y < -5.8e-98 or 2.7499999999999998e-19 < y < 2.8e5Initial program 99.9%
Taylor expanded in x around 0 74.9%
+-commutative74.9%
Simplified74.9%
if -5.8e-98 < y < 2.7499999999999998e-19Initial program 100.0%
Taylor expanded in y around 0 80.4%
if 2.8e5 < y Initial program 100.0%
Taylor expanded in y around inf 98.6%
associate--l+98.6%
div-sub98.6%
sub-neg98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in x around inf 98.6%
Taylor expanded in y around 0 98.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))) (t_1 (/ y (+ y 1.0))))
(if (<= y -12200000.0)
t_0
(if (<= y -5.8e-98)
t_1
(if (<= y 1.2e-22) x (if (<= y 63000.0) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double t_1 = y / (y + 1.0);
double tmp;
if (y <= -12200000.0) {
tmp = t_0;
} else if (y <= -5.8e-98) {
tmp = t_1;
} else if (y <= 1.2e-22) {
tmp = x;
} else if (y <= 63000.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 = y / (y + 1.0d0)
if (y <= (-12200000.0d0)) then
tmp = t_0
else if (y <= (-5.8d-98)) then
tmp = t_1
else if (y <= 1.2d-22) then
tmp = x
else if (y <= 63000.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 = y / (y + 1.0);
double tmp;
if (y <= -12200000.0) {
tmp = t_0;
} else if (y <= -5.8e-98) {
tmp = t_1;
} else if (y <= 1.2e-22) {
tmp = x;
} else if (y <= 63000.0) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (x / y) t_1 = y / (y + 1.0) tmp = 0 if y <= -12200000.0: tmp = t_0 elif y <= -5.8e-98: tmp = t_1 elif y <= 1.2e-22: tmp = x elif y <= 63000.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(y / Float64(y + 1.0)) tmp = 0.0 if (y <= -12200000.0) tmp = t_0; elseif (y <= -5.8e-98) tmp = t_1; elseif (y <= 1.2e-22) tmp = x; elseif (y <= 63000.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 = y / (y + 1.0); tmp = 0.0; if (y <= -12200000.0) tmp = t_0; elseif (y <= -5.8e-98) tmp = t_1; elseif (y <= 1.2e-22) tmp = x; elseif (y <= 63000.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[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -12200000.0], t$95$0, If[LessEqual[y, -5.8e-98], t$95$1, If[LessEqual[y, 1.2e-22], x, If[LessEqual[y, 63000.0], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{y}\\
t_1 := \frac{y}{y + 1}\\
\mathbf{if}\;y \leq -12200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 63000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.22e7 or 63000 < y Initial program 99.9%
Taylor expanded in y around inf 98.7%
associate--l+98.7%
div-sub98.7%
sub-neg98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in x around inf 98.7%
if -1.22e7 < y < -5.8e-98 or 1.20000000000000001e-22 < y < 63000Initial program 99.9%
Taylor expanded in x around 0 74.9%
+-commutative74.9%
Simplified74.9%
if -5.8e-98 < y < 1.20000000000000001e-22Initial program 100.0%
Taylor expanded in y around 0 80.4%
(FPCore (x y)
:precision binary64
(if (<= y -0.0005)
1.0
(if (<= y -5.8e-98)
y
(if (<= y 1.35e-17) x (if (<= y 2.7e+151) (/ x y) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -0.0005) {
tmp = 1.0;
} else if (y <= -5.8e-98) {
tmp = y;
} else if (y <= 1.35e-17) {
tmp = x;
} else if (y <= 2.7e+151) {
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 <= (-0.0005d0)) then
tmp = 1.0d0
else if (y <= (-5.8d-98)) then
tmp = y
else if (y <= 1.35d-17) then
tmp = x
else if (y <= 2.7d+151) 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 <= -0.0005) {
tmp = 1.0;
} else if (y <= -5.8e-98) {
tmp = y;
} else if (y <= 1.35e-17) {
tmp = x;
} else if (y <= 2.7e+151) {
tmp = x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0005: tmp = 1.0 elif y <= -5.8e-98: tmp = y elif y <= 1.35e-17: tmp = x elif y <= 2.7e+151: tmp = x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0005) tmp = 1.0; elseif (y <= -5.8e-98) tmp = y; elseif (y <= 1.35e-17) tmp = x; elseif (y <= 2.7e+151) tmp = Float64(x / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0005) tmp = 1.0; elseif (y <= -5.8e-98) tmp = y; elseif (y <= 1.35e-17) tmp = x; elseif (y <= 2.7e+151) tmp = x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0005], 1.0, If[LessEqual[y, -5.8e-98], y, If[LessEqual[y, 1.35e-17], x, If[LessEqual[y, 2.7e+151], N[(x / y), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0005:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-98}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+151}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.0000000000000001e-4 or 2.7000000000000001e151 < y Initial program 99.9%
Taylor expanded in y around inf 70.1%
if -5.0000000000000001e-4 < y < -5.8e-98Initial program 100.0%
Taylor expanded in x around 0 69.3%
+-commutative69.3%
Simplified69.3%
Taylor expanded in y around 0 69.3%
if -5.8e-98 < y < 1.3500000000000001e-17Initial program 100.0%
Taylor expanded in y around 0 79.8%
if 1.3500000000000001e-17 < y < 2.7000000000000001e151Initial program 99.9%
Taylor expanded in x around inf 52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in y around inf 49.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= y -1.0)
t_0
(if (<= y -5.8e-98) y (if (<= y 11000000000.0) (/ x (+ y 1.0)) 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 <= -5.8e-98) {
tmp = y;
} else if (y <= 11000000000.0) {
tmp = x / (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 / y)
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-5.8d-98)) then
tmp = y
else if (y <= 11000000000.0d0) then
tmp = x / (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 / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -5.8e-98) {
tmp = y;
} else if (y <= 11000000000.0) {
tmp = x / (y + 1.0);
} 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 <= -5.8e-98: tmp = y elif y <= 11000000000.0: tmp = x / (y + 1.0) 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 <= -5.8e-98) tmp = y; elseif (y <= 11000000000.0) tmp = Float64(x / Float64(y + 1.0)); 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 <= -5.8e-98) tmp = y; elseif (y <= 11000000000.0) tmp = x / (y + 1.0); 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, -5.8e-98], y, If[LessEqual[y, 11000000000.0], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 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 -5.8 \cdot 10^{-98}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 11000000000:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 1.1e10 < y Initial program 99.9%
Taylor expanded in y around inf 99.3%
associate--l+99.3%
div-sub99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around inf 99.0%
if -1 < y < -5.8e-98Initial program 100.0%
Taylor expanded in x around 0 65.7%
+-commutative65.7%
Simplified65.7%
Taylor expanded in y around 0 65.7%
if -5.8e-98 < y < 1.1e10Initial program 100.0%
Taylor expanded in x around inf 77.2%
+-commutative77.2%
Simplified77.2%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= y -1.0) t_0 (if (<= y -5.8e-98) y (if (<= y 6.2e-19) 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 <= -5.8e-98) {
tmp = y;
} else if (y <= 6.2e-19) {
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 <= (-5.8d-98)) then
tmp = y
else if (y <= 6.2d-19) 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 <= -5.8e-98) {
tmp = y;
} else if (y <= 6.2e-19) {
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 <= -5.8e-98: tmp = y elif y <= 6.2e-19: 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 <= -5.8e-98) tmp = y; elseif (y <= 6.2e-19) 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 <= -5.8e-98) tmp = y; elseif (y <= 6.2e-19) 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, -5.8e-98], y, If[LessEqual[y, 6.2e-19], 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 -5.8 \cdot 10^{-98}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 6.1999999999999998e-19 < y Initial program 99.9%
Taylor expanded in y around inf 93.8%
associate--l+93.8%
div-sub93.8%
sub-neg93.8%
metadata-eval93.8%
Simplified93.8%
Taylor expanded in x around inf 93.8%
if -1 < y < -5.8e-98Initial program 100.0%
Taylor expanded in x around 0 65.7%
+-commutative65.7%
Simplified65.7%
Taylor expanded in y around 0 65.7%
if -5.8e-98 < y < 6.1999999999999998e-19Initial program 100.0%
Taylor expanded in y around 0 80.4%
(FPCore (x y) :precision binary64 (if (<= y -0.0005) 1.0 (if (<= y -5.8e-98) y (if (<= y 6.2e-19) x 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -0.0005) {
tmp = 1.0;
} else if (y <= -5.8e-98) {
tmp = y;
} else if (y <= 6.2e-19) {
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 <= (-0.0005d0)) then
tmp = 1.0d0
else if (y <= (-5.8d-98)) then
tmp = y
else if (y <= 6.2d-19) 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 <= -0.0005) {
tmp = 1.0;
} else if (y <= -5.8e-98) {
tmp = y;
} else if (y <= 6.2e-19) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.0005: tmp = 1.0 elif y <= -5.8e-98: tmp = y elif y <= 6.2e-19: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.0005) tmp = 1.0; elseif (y <= -5.8e-98) tmp = y; elseif (y <= 6.2e-19) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.0005) tmp = 1.0; elseif (y <= -5.8e-98) tmp = y; elseif (y <= 6.2e-19) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.0005], 1.0, If[LessEqual[y, -5.8e-98], y, If[LessEqual[y, 6.2e-19], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0005:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-98}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.0000000000000001e-4 or 6.1999999999999998e-19 < y Initial program 99.9%
Taylor expanded in y around inf 60.4%
if -5.0000000000000001e-4 < y < -5.8e-98Initial program 100.0%
Taylor expanded in x around 0 69.3%
+-commutative69.3%
Simplified69.3%
Taylor expanded in y around 0 69.3%
if -5.8e-98 < y < 6.1999999999999998e-19Initial program 100.0%
Taylor expanded in y around 0 80.4%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 6.2e-19) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 6.2e-19) {
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 <= 6.2d-19) 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 <= 6.2e-19) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 6.2e-19: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 6.2e-19) 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 <= 6.2e-19) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 6.2e-19], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 6.1999999999999998e-19 < y Initial program 99.9%
Taylor expanded in y around inf 60.9%
if -1 < y < 6.1999999999999998e-19Initial program 100.0%
Taylor expanded in y around 0 73.8%
(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 29.2%
herbie shell --seed 2024152
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))