
(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 8 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.0)
(+ 1.0 (/ x y))
(if (<= y -2.3e-158)
(- y (* y y))
(if (<= y 3.8e-52)
x
(if (<= y 460000.0) (/ y (+ y 1.0)) (+ 1.0 (/ (+ x -1.0) y)))))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0 + (x / y);
} else if (y <= -2.3e-158) {
tmp = y - (y * y);
} else if (y <= 3.8e-52) {
tmp = x;
} else if (y <= 460000.0) {
tmp = y / (y + 1.0);
} else {
tmp = 1.0 + ((x + -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 (y <= (-1.0d0)) then
tmp = 1.0d0 + (x / y)
else if (y <= (-2.3d-158)) then
tmp = y - (y * y)
else if (y <= 3.8d-52) then
tmp = x
else if (y <= 460000.0d0) then
tmp = y / (y + 1.0d0)
else
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0 + (x / y);
} else if (y <= -2.3e-158) {
tmp = y - (y * y);
} else if (y <= 3.8e-52) {
tmp = x;
} else if (y <= 460000.0) {
tmp = y / (y + 1.0);
} else {
tmp = 1.0 + ((x + -1.0) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 + (x / y) elif y <= -2.3e-158: tmp = y - (y * y) elif y <= 3.8e-52: tmp = x elif y <= 460000.0: tmp = y / (y + 1.0) else: tmp = 1.0 + ((x + -1.0) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(1.0 + Float64(x / y)); elseif (y <= -2.3e-158) tmp = Float64(y - Float64(y * y)); elseif (y <= 3.8e-52) tmp = x; elseif (y <= 460000.0) tmp = Float64(y / Float64(y + 1.0)); else tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = 1.0 + (x / y); elseif (y <= -2.3e-158) tmp = y - (y * y); elseif (y <= 3.8e-52) tmp = x; elseif (y <= 460000.0) tmp = y / (y + 1.0); else tmp = 1.0 + ((x + -1.0) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.3e-158], N[(y - N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e-52], x, If[LessEqual[y, 460000.0], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{-158}:\\
\;\;\;\;y - y \cdot y\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 460000:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\end{array}
\end{array}
if y < -1Initial program 99.9%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -1 < y < -2.2999999999999999e-158Initial program 99.9%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in y around 0 59.1%
neg-mul-159.1%
distribute-lft-in59.2%
*-rgt-identity59.2%
distribute-rgt-neg-in59.2%
unpow259.2%
unsub-neg59.2%
Simplified59.2%
unpow259.2%
Applied egg-rr59.2%
if -2.2999999999999999e-158 < y < 3.8000000000000003e-52Initial program 100.0%
Taylor expanded in y around 0 80.7%
if 3.8000000000000003e-52 < y < 4.6e5Initial program 100.0%
Taylor expanded in x around 0 73.5%
+-commutative73.5%
Simplified73.5%
if 4.6e5 < y Initial program 100.0%
Taylor expanded in y around inf 99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= y -1.0)
t_0
(if (<= y -2.3e-158)
(- y (* y y))
(if (<= y 5.7e-52) x (if (<= y 720000000000.0) (/ y (+ 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 <= -2.3e-158) {
tmp = y - (y * y);
} else if (y <= 5.7e-52) {
tmp = x;
} else if (y <= 720000000000.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 / y)
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-2.3d-158)) then
tmp = y - (y * y)
else if (y <= 5.7d-52) then
tmp = x
else if (y <= 720000000000.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 / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -2.3e-158) {
tmp = y - (y * y);
} else if (y <= 5.7e-52) {
tmp = x;
} else if (y <= 720000000000.0) {
tmp = y / (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 <= -2.3e-158: tmp = y - (y * y) elif y <= 5.7e-52: tmp = x elif y <= 720000000000.0: tmp = y / (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 <= -2.3e-158) tmp = Float64(y - Float64(y * y)); elseif (y <= 5.7e-52) tmp = x; elseif (y <= 720000000000.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 / y); tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= -2.3e-158) tmp = y - (y * y); elseif (y <= 5.7e-52) tmp = x; elseif (y <= 720000000000.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[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, -2.3e-158], N[(y - N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.7e-52], x, If[LessEqual[y, 720000000000.0], N[(y / 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 -2.3 \cdot 10^{-158}:\\
\;\;\;\;y - y \cdot y\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 720000000000:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 7.2e11 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -1 < y < -2.2999999999999999e-158Initial program 99.9%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in y around 0 59.1%
neg-mul-159.1%
distribute-lft-in59.2%
*-rgt-identity59.2%
distribute-rgt-neg-in59.2%
unpow259.2%
unsub-neg59.2%
Simplified59.2%
unpow259.2%
Applied egg-rr59.2%
if -2.2999999999999999e-158 < y < 5.6999999999999997e-52Initial program 100.0%
Taylor expanded in y around 0 80.7%
if 5.6999999999999997e-52 < y < 7.2e11Initial program 100.0%
Taylor expanded in x around 0 75.9%
+-commutative75.9%
Simplified75.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= y -1.0)
t_0
(if (<= y -2.3e-158) (- y (* y y)) (if (<= y 6.7e-6) 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 <= -2.3e-158) {
tmp = y - (y * y);
} else if (y <= 6.7e-6) {
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 <= (-2.3d-158)) then
tmp = y - (y * y)
else if (y <= 6.7d-6) 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 <= -2.3e-158) {
tmp = y - (y * y);
} else if (y <= 6.7e-6) {
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 <= -2.3e-158: tmp = y - (y * y) elif y <= 6.7e-6: 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 <= -2.3e-158) tmp = Float64(y - Float64(y * y)); elseif (y <= 6.7e-6) 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 <= -2.3e-158) tmp = y - (y * y); elseif (y <= 6.7e-6) 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, -2.3e-158], N[(y - N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.7e-6], 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 -2.3 \cdot 10^{-158}:\\
\;\;\;\;y - y \cdot y\\
\mathbf{elif}\;y \leq 6.7 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 6.7e-6 < y Initial program 100.0%
Taylor expanded in y around inf 98.0%
associate--l+98.0%
div-sub98.0%
sub-neg98.0%
metadata-eval98.0%
Simplified98.0%
Taylor expanded in x around inf 96.9%
if -1 < y < -2.2999999999999999e-158Initial program 99.9%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in y around 0 59.1%
neg-mul-159.1%
distribute-lft-in59.2%
*-rgt-identity59.2%
distribute-rgt-neg-in59.2%
unpow259.2%
unsub-neg59.2%
Simplified59.2%
unpow259.2%
Applied egg-rr59.2%
if -2.2999999999999999e-158 < y < 6.7e-6Initial program 100.0%
Taylor expanded in y around 0 75.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (/ x y)))) (if (<= y -1.0) t_0 (if (<= y -2.3e-158) y (if (<= y 6.7e-6) 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 <= -2.3e-158) {
tmp = y;
} else if (y <= 6.7e-6) {
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 <= (-2.3d-158)) then
tmp = y
else if (y <= 6.7d-6) 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 <= -2.3e-158) {
tmp = y;
} else if (y <= 6.7e-6) {
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 <= -2.3e-158: tmp = y elif y <= 6.7e-6: 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 <= -2.3e-158) tmp = y; elseif (y <= 6.7e-6) 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 <= -2.3e-158) tmp = y; elseif (y <= 6.7e-6) 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, -2.3e-158], y, If[LessEqual[y, 6.7e-6], 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 -2.3 \cdot 10^{-158}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6.7 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 6.7e-6 < y Initial program 100.0%
Taylor expanded in y around inf 98.0%
associate--l+98.0%
div-sub98.0%
sub-neg98.0%
metadata-eval98.0%
Simplified98.0%
Taylor expanded in x around inf 96.9%
if -1 < y < -2.2999999999999999e-158Initial program 99.9%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in y around 0 59.1%
neg-mul-159.1%
distribute-lft-in59.2%
*-rgt-identity59.2%
distribute-rgt-neg-in59.2%
unpow259.2%
unsub-neg59.2%
Simplified59.2%
Taylor expanded in y around 0 58.8%
if -2.2999999999999999e-158 < y < 6.7e-6Initial program 100.0%
Taylor expanded in y around 0 75.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y -2.3e-158) y (if (<= y 6.7e-6) x 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -2.3e-158) {
tmp = y;
} else if (y <= 6.7e-6) {
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.3d-158)) then
tmp = y
else if (y <= 6.7d-6) 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.3e-158) {
tmp = y;
} else if (y <= 6.7e-6) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= -2.3e-158: tmp = y elif y <= 6.7e-6: 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.3e-158) tmp = y; elseif (y <= 6.7e-6) 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.3e-158) tmp = y; elseif (y <= 6.7e-6) 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.3e-158], y, If[LessEqual[y, 6.7e-6], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{-158}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 6.7 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 6.7e-6 < y Initial program 100.0%
Taylor expanded in y around inf 78.0%
if -1 < y < -2.2999999999999999e-158Initial program 99.9%
Taylor expanded in x around 0 59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in y around 0 59.1%
neg-mul-159.1%
distribute-lft-in59.2%
*-rgt-identity59.2%
distribute-rgt-neg-in59.2%
unpow259.2%
unsub-neg59.2%
Simplified59.2%
Taylor expanded in y around 0 58.8%
if -2.2999999999999999e-158 < y < 6.7e-6Initial program 100.0%
Taylor expanded in y around 0 75.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 6.7e-6) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 6.7e-6) {
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.7d-6) 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.7e-6) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 6.7e-6: 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.7e-6) 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.7e-6) 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.7e-6], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.7 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 6.7e-6 < y Initial program 100.0%
Taylor expanded in y around inf 78.0%
if -1 < y < 6.7e-6Initial program 100.0%
Taylor expanded in y around 0 68.4%
(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 2024186
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))