
(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 -4e+53)
1.0
(if (<= y -7.4e+15)
(/ x y)
(if (<= y 5.8e-44)
x
(if (<= y 0.75) (* y (- 1.0 y)) (if (<= y 6.4e+83) (/ x y) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -4e+53) {
tmp = 1.0;
} else if (y <= -7.4e+15) {
tmp = x / y;
} else if (y <= 5.8e-44) {
tmp = x;
} else if (y <= 0.75) {
tmp = y * (1.0 - y);
} else if (y <= 6.4e+83) {
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 <= (-4d+53)) then
tmp = 1.0d0
else if (y <= (-7.4d+15)) then
tmp = x / y
else if (y <= 5.8d-44) then
tmp = x
else if (y <= 0.75d0) then
tmp = y * (1.0d0 - y)
else if (y <= 6.4d+83) 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 <= -4e+53) {
tmp = 1.0;
} else if (y <= -7.4e+15) {
tmp = x / y;
} else if (y <= 5.8e-44) {
tmp = x;
} else if (y <= 0.75) {
tmp = y * (1.0 - y);
} else if (y <= 6.4e+83) {
tmp = x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4e+53: tmp = 1.0 elif y <= -7.4e+15: tmp = x / y elif y <= 5.8e-44: tmp = x elif y <= 0.75: tmp = y * (1.0 - y) elif y <= 6.4e+83: tmp = x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -4e+53) tmp = 1.0; elseif (y <= -7.4e+15) tmp = Float64(x / y); elseif (y <= 5.8e-44) tmp = x; elseif (y <= 0.75) tmp = Float64(y * Float64(1.0 - y)); elseif (y <= 6.4e+83) tmp = Float64(x / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4e+53) tmp = 1.0; elseif (y <= -7.4e+15) tmp = x / y; elseif (y <= 5.8e-44) tmp = x; elseif (y <= 0.75) tmp = y * (1.0 - y); elseif (y <= 6.4e+83) tmp = x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4e+53], 1.0, If[LessEqual[y, -7.4e+15], N[(x / y), $MachinePrecision], If[LessEqual[y, 5.8e-44], x, If[LessEqual[y, 0.75], N[(y * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e+83], N[(x / y), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+53}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -7.4 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;y \cdot \left(1 - y\right)\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4e53 or 6.3999999999999998e83 < y Initial program 100.0%
Taylor expanded in y around inf 89.1%
if -4e53 < y < -7.4e15 or 0.75 < y < 6.3999999999999998e83Initial program 100.0%
Taylor expanded in x around inf 79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in y around inf 77.2%
if -7.4e15 < y < 5.8000000000000003e-44Initial program 100.0%
Taylor expanded in y around 0 72.4%
if 5.8000000000000003e-44 < y < 0.75Initial program 99.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 86.0%
neg-mul-186.0%
sub-neg86.0%
Simplified86.0%
(FPCore (x y)
:precision binary64
(if (<= y -3.5e+53)
1.0
(if (<= y -7.4e+15)
(/ x y)
(if (<= y 1.28e-43)
x
(if (<= y 0.46) y (if (<= y 6.4e+83) (/ x y) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -3.5e+53) {
tmp = 1.0;
} else if (y <= -7.4e+15) {
tmp = x / y;
} else if (y <= 1.28e-43) {
tmp = x;
} else if (y <= 0.46) {
tmp = y;
} else if (y <= 6.4e+83) {
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 <= (-3.5d+53)) then
tmp = 1.0d0
else if (y <= (-7.4d+15)) then
tmp = x / y
else if (y <= 1.28d-43) then
tmp = x
else if (y <= 0.46d0) then
tmp = y
else if (y <= 6.4d+83) 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 <= -3.5e+53) {
tmp = 1.0;
} else if (y <= -7.4e+15) {
tmp = x / y;
} else if (y <= 1.28e-43) {
tmp = x;
} else if (y <= 0.46) {
tmp = y;
} else if (y <= 6.4e+83) {
tmp = x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.5e+53: tmp = 1.0 elif y <= -7.4e+15: tmp = x / y elif y <= 1.28e-43: tmp = x elif y <= 0.46: tmp = y elif y <= 6.4e+83: tmp = x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.5e+53) tmp = 1.0; elseif (y <= -7.4e+15) tmp = Float64(x / y); elseif (y <= 1.28e-43) tmp = x; elseif (y <= 0.46) tmp = y; elseif (y <= 6.4e+83) tmp = Float64(x / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.5e+53) tmp = 1.0; elseif (y <= -7.4e+15) tmp = x / y; elseif (y <= 1.28e-43) tmp = x; elseif (y <= 0.46) tmp = y; elseif (y <= 6.4e+83) tmp = x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.5e+53], 1.0, If[LessEqual[y, -7.4e+15], N[(x / y), $MachinePrecision], If[LessEqual[y, 1.28e-43], x, If[LessEqual[y, 0.46], y, If[LessEqual[y, 6.4e+83], N[(x / y), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+53}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -7.4 \cdot 10^{+15}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq 1.28 \cdot 10^{-43}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.46:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.50000000000000019e53 or 6.3999999999999998e83 < y Initial program 100.0%
Taylor expanded in y around inf 89.1%
if -3.50000000000000019e53 < y < -7.4e15 or 0.46000000000000002 < y < 6.3999999999999998e83Initial program 100.0%
Taylor expanded in x around inf 79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in y around inf 77.2%
if -7.4e15 < y < 1.27999999999999998e-43Initial program 100.0%
Taylor expanded in y around 0 72.4%
if 1.27999999999999998e-43 < y < 0.46000000000000002Initial program 99.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 82.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= y -7600.0)
t_0
(if (<= y 1.95e-44)
(/ x (+ y 1.0))
(if (<= y 0.95) (* y (- 1.0 y)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (y <= -7600.0) {
tmp = t_0;
} else if (y <= 1.95e-44) {
tmp = x / (y + 1.0);
} else if (y <= 0.95) {
tmp = y * (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 <= (-7600.0d0)) then
tmp = t_0
else if (y <= 1.95d-44) then
tmp = x / (y + 1.0d0)
else if (y <= 0.95d0) then
tmp = y * (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 <= -7600.0) {
tmp = t_0;
} else if (y <= 1.95e-44) {
tmp = x / (y + 1.0);
} else if (y <= 0.95) {
tmp = y * (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 <= -7600.0: tmp = t_0 elif y <= 1.95e-44: tmp = x / (y + 1.0) elif y <= 0.95: tmp = y * (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 <= -7600.0) tmp = t_0; elseif (y <= 1.95e-44) tmp = Float64(x / Float64(y + 1.0)); elseif (y <= 0.95) tmp = Float64(y * 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 <= -7600.0) tmp = t_0; elseif (y <= 1.95e-44) tmp = x / (y + 1.0); elseif (y <= 0.95) tmp = y * (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, -7600.0], t$95$0, If[LessEqual[y, 1.95e-44], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.95], N[(y * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;y \leq -7600:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-44}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 0.95:\\
\;\;\;\;y \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7600 or 0.94999999999999996 < y Initial program 100.0%
Taylor expanded in y around inf 99.6%
associate--l+99.6%
div-sub99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
if -7600 < y < 1.9500000000000001e-44Initial program 100.0%
Taylor expanded in x around inf 74.5%
+-commutative74.5%
Simplified74.5%
if 1.9500000000000001e-44 < y < 0.94999999999999996Initial program 99.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 86.0%
neg-mul-186.0%
sub-neg86.0%
Simplified86.0%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 1.25e-46) x (if (<= y 1.0) y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 1.25e-46) {
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.0d0)) then
tmp = 1.0d0
else if (y <= 1.25d-46) 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.0) {
tmp = 1.0;
} else if (y <= 1.25e-46) {
tmp = x;
} else if (y <= 1.0) {
tmp = y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 1.25e-46: tmp = x elif y <= 1.0: tmp = y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 1.25e-46) 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.0) tmp = 1.0; elseif (y <= 1.25e-46) tmp = x; elseif (y <= 1.0) tmp = y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 1.25e-46], x, If[LessEqual[y, 1.0], y, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{-46}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 75.3%
if -1 < y < 1.24999999999999998e-46Initial program 100.0%
Taylor expanded in y around 0 74.1%
if 1.24999999999999998e-46 < y < 1Initial program 99.8%
Taylor expanded in x around 0 85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in y around 0 82.4%
(FPCore (x y) :precision binary64 (if (<= y -3.5e+53) 1.0 (if (<= y 6.4e+83) (/ x (+ y 1.0)) (/ y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3.5e+53) {
tmp = 1.0;
} else if (y <= 6.4e+83) {
tmp = 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 (y <= (-3.5d+53)) then
tmp = 1.0d0
else if (y <= 6.4d+83) then
tmp = 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 (y <= -3.5e+53) {
tmp = 1.0;
} else if (y <= 6.4e+83) {
tmp = x / (y + 1.0);
} else {
tmp = y / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.5e+53: tmp = 1.0 elif y <= 6.4e+83: tmp = x / (y + 1.0) else: tmp = y / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.5e+53) tmp = 1.0; elseif (y <= 6.4e+83) tmp = 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 (y <= -3.5e+53) tmp = 1.0; elseif (y <= 6.4e+83) tmp = x / (y + 1.0); else tmp = y / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.5e+53], 1.0, If[LessEqual[y, 6.4e+83], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+53}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + 1}\\
\end{array}
\end{array}
if y < -3.50000000000000019e53Initial program 100.0%
Taylor expanded in y around inf 89.7%
if -3.50000000000000019e53 < y < 6.3999999999999998e83Initial program 100.0%
Taylor expanded in x around inf 71.0%
+-commutative71.0%
Simplified71.0%
if 6.3999999999999998e83 < y Initial program 100.0%
Taylor expanded in x around 0 88.2%
+-commutative88.2%
Simplified88.2%
(FPCore (x y) :precision binary64 (if (<= y -3.8e+53) 1.0 (if (<= y 1.65e+85) (/ x (+ y 1.0)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -3.8e+53) {
tmp = 1.0;
} else if (y <= 1.65e+85) {
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) :: tmp
if (y <= (-3.8d+53)) then
tmp = 1.0d0
else if (y <= 1.65d+85) 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 tmp;
if (y <= -3.8e+53) {
tmp = 1.0;
} else if (y <= 1.65e+85) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.8e+53: tmp = 1.0 elif y <= 1.65e+85: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.8e+53) tmp = 1.0; elseif (y <= 1.65e+85) tmp = Float64(x / Float64(y + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.8e+53) tmp = 1.0; elseif (y <= 1.65e+85) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.8e+53], 1.0, If[LessEqual[y, 1.65e+85], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+53}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+85}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.79999999999999997e53 or 1.65e85 < y Initial program 100.0%
Taylor expanded in y around inf 89.1%
if -3.79999999999999997e53 < y < 1.65e85Initial program 100.0%
Taylor expanded in x around inf 71.0%
+-commutative71.0%
Simplified71.0%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 1.35e-39) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 1.35e-39) {
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 <= 1.35d-39) 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 <= 1.35e-39) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 1.35e-39: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 1.35e-39) 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 <= 1.35e-39) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 1.35e-39], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 1.35e-39 < y Initial program 100.0%
Taylor expanded in y around inf 72.9%
if -1 < y < 1.35e-39Initial program 100.0%
Taylor expanded in y around 0 73.2%
(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.6%
herbie shell --seed 2024170
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))