
(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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.5e+44)
1.0
(if (<= y -1.04e+37)
(/ x y)
(if (<= y -5e-8)
1.0
(if (<= y -1.95e-35) y (if (<= y 1.12e+72) (/ x (+ y 1.0)) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -5.5e+44) {
tmp = 1.0;
} else if (y <= -1.04e+37) {
tmp = x / y;
} else if (y <= -5e-8) {
tmp = 1.0;
} else if (y <= -1.95e-35) {
tmp = y;
} else if (y <= 1.12e+72) {
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 <= (-5.5d+44)) then
tmp = 1.0d0
else if (y <= (-1.04d+37)) then
tmp = x / y
else if (y <= (-5d-8)) then
tmp = 1.0d0
else if (y <= (-1.95d-35)) then
tmp = y
else if (y <= 1.12d+72) 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 <= -5.5e+44) {
tmp = 1.0;
} else if (y <= -1.04e+37) {
tmp = x / y;
} else if (y <= -5e-8) {
tmp = 1.0;
} else if (y <= -1.95e-35) {
tmp = y;
} else if (y <= 1.12e+72) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.5e+44: tmp = 1.0 elif y <= -1.04e+37: tmp = x / y elif y <= -5e-8: tmp = 1.0 elif y <= -1.95e-35: tmp = y elif y <= 1.12e+72: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.5e+44) tmp = 1.0; elseif (y <= -1.04e+37) tmp = Float64(x / y); elseif (y <= -5e-8) tmp = 1.0; elseif (y <= -1.95e-35) tmp = y; elseif (y <= 1.12e+72) 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 <= -5.5e+44) tmp = 1.0; elseif (y <= -1.04e+37) tmp = x / y; elseif (y <= -5e-8) tmp = 1.0; elseif (y <= -1.95e-35) tmp = y; elseif (y <= 1.12e+72) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.5e+44], 1.0, If[LessEqual[y, -1.04e+37], N[(x / y), $MachinePrecision], If[LessEqual[y, -5e-8], 1.0, If[LessEqual[y, -1.95e-35], y, If[LessEqual[y, 1.12e+72], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.04 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-8}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-35}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+72}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.5000000000000001e44 or -1.0400000000000001e37 < y < -4.9999999999999998e-8 or 1.12000000000000001e72 < y Initial program 100.0%
Taylor expanded in y around inf 79.5%
if -5.5000000000000001e44 < y < -1.0400000000000001e37Initial program 100.0%
Taylor expanded in x around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -4.9999999999999998e-8 < y < -1.9499999999999999e-35Initial program 100.0%
Taylor expanded in y around 0 95.2%
Taylor expanded in x around 0 95.2%
if -1.9499999999999999e-35 < y < 1.12000000000000001e72Initial program 100.0%
Taylor expanded in x around inf 79.9%
+-commutative79.9%
Simplified79.9%
Final simplification80.4%
(FPCore (x y)
:precision binary64
(if (<= y -5.5e+44)
1.0
(if (<= y -6.4e+37)
(/ x y)
(if (<= y -1.0) 1.0 (if (<= y 0.78) (- x (* x y)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -5.5e+44) {
tmp = 1.0;
} else if (y <= -6.4e+37) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.78) {
tmp = x - (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 <= (-5.5d+44)) then
tmp = 1.0d0
else if (y <= (-6.4d+37)) then
tmp = x / y
else if (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= 0.78d0) then
tmp = x - (x * y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.5e+44) {
tmp = 1.0;
} else if (y <= -6.4e+37) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.78) {
tmp = x - (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.5e+44: tmp = 1.0 elif y <= -6.4e+37: tmp = x / y elif y <= -1.0: tmp = 1.0 elif y <= 0.78: tmp = x - (x * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.5e+44) tmp = 1.0; elseif (y <= -6.4e+37) tmp = Float64(x / y); elseif (y <= -1.0) tmp = 1.0; elseif (y <= 0.78) tmp = Float64(x - Float64(x * y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.5e+44) tmp = 1.0; elseif (y <= -6.4e+37) tmp = x / y; elseif (y <= -1.0) tmp = 1.0; elseif (y <= 0.78) tmp = x - (x * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.5e+44], 1.0, If[LessEqual[y, -6.4e+37], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 0.78], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -6.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 0.78:\\
\;\;\;\;x - x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.5000000000000001e44 or -6.40000000000000027e37 < y < -1 or 0.78000000000000003 < y Initial program 100.0%
Taylor expanded in y around inf 76.1%
if -5.5000000000000001e44 < y < -6.40000000000000027e37Initial program 100.0%
Taylor expanded in x around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -1 < y < 0.78000000000000003Initial program 100.0%
Taylor expanded in y around 0 99.6%
Taylor expanded in x around inf 78.5%
neg-mul-178.5%
distribute-lft-in78.5%
*-rgt-identity78.5%
distribute-rgt-neg-in78.5%
unsub-neg78.5%
Simplified78.5%
Final simplification77.7%
(FPCore (x y)
:precision binary64
(if (<= y -6.2e+44)
1.0
(if (<= y -7.6e+37)
(/ x y)
(if (<= y -1.6e-35)
(/ y (+ y 1.0))
(if (<= y 1.9e+72) (/ x (+ y 1.0)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -6.2e+44) {
tmp = 1.0;
} else if (y <= -7.6e+37) {
tmp = x / y;
} else if (y <= -1.6e-35) {
tmp = y / (y + 1.0);
} else if (y <= 1.9e+72) {
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 <= (-6.2d+44)) then
tmp = 1.0d0
else if (y <= (-7.6d+37)) then
tmp = x / y
else if (y <= (-1.6d-35)) then
tmp = y / (y + 1.0d0)
else if (y <= 1.9d+72) 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 <= -6.2e+44) {
tmp = 1.0;
} else if (y <= -7.6e+37) {
tmp = x / y;
} else if (y <= -1.6e-35) {
tmp = y / (y + 1.0);
} else if (y <= 1.9e+72) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.2e+44: tmp = 1.0 elif y <= -7.6e+37: tmp = x / y elif y <= -1.6e-35: tmp = y / (y + 1.0) elif y <= 1.9e+72: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6.2e+44) tmp = 1.0; elseif (y <= -7.6e+37) tmp = Float64(x / y); elseif (y <= -1.6e-35) tmp = Float64(y / Float64(y + 1.0)); elseif (y <= 1.9e+72) 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 <= -6.2e+44) tmp = 1.0; elseif (y <= -7.6e+37) tmp = x / y; elseif (y <= -1.6e-35) tmp = y / (y + 1.0); elseif (y <= 1.9e+72) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.2e+44], 1.0, If[LessEqual[y, -7.6e+37], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.6e-35], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+72], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -7.6 \cdot 10^{+37}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+72}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.19999999999999991e44 or 1.90000000000000003e72 < y Initial program 100.0%
Taylor expanded in y around inf 81.5%
if -6.19999999999999991e44 < y < -7.59999999999999979e37Initial program 100.0%
Taylor expanded in x around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -7.59999999999999979e37 < y < -1.5999999999999999e-35Initial program 100.0%
Taylor expanded in x around 0 76.5%
+-commutative76.5%
Simplified76.5%
if -1.5999999999999999e-35 < y < 1.90000000000000003e72Initial program 100.0%
Taylor expanded in x around inf 79.9%
+-commutative79.9%
Simplified79.9%
Final simplification80.8%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.86))) (/ (+ x y) y) (+ x (* y (- 1.0 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.86)) {
tmp = (x + y) / y;
} 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.0d0)) .or. (.not. (y <= 0.86d0))) then
tmp = (x + y) / y
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.0) || !(y <= 0.86)) {
tmp = (x + y) / y;
} else {
tmp = x + (y * (1.0 - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.86): tmp = (x + y) / y else: tmp = x + (y * (1.0 - x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.86)) tmp = Float64(Float64(x + y) / y); 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.0) || ~((y <= 0.86))) tmp = (x + y) / y; else tmp = x + (y * (1.0 - x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.86]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision], N[(x + N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.86\right):\\
\;\;\;\;\frac{x + y}{y}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - x\right)\\
\end{array}
\end{array}
if y < -1 or 0.859999999999999987 < y Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 96.5%
*-commutative96.5%
div-inv96.7%
+-commutative96.7%
Applied egg-rr96.7%
if -1 < y < 0.859999999999999987Initial program 100.0%
Taylor expanded in y around 0 99.6%
Final simplification98.1%
(FPCore (x y)
:precision binary64
(if (<= y -5.8e+44)
1.0
(if (<= y -1.7e+38)
(/ x y)
(if (<= y -1.0) 1.0 (if (<= y 13000.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -5.8e+44) {
tmp = 1.0;
} else if (y <= -1.7e+38) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 13000.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 <= (-5.8d+44)) then
tmp = 1.0d0
else if (y <= (-1.7d+38)) then
tmp = x / y
else if (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= 13000.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 <= -5.8e+44) {
tmp = 1.0;
} else if (y <= -1.7e+38) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 13000.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.8e+44: tmp = 1.0 elif y <= -1.7e+38: tmp = x / y elif y <= -1.0: tmp = 1.0 elif y <= 13000.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.8e+44) tmp = 1.0; elseif (y <= -1.7e+38) tmp = Float64(x / y); elseif (y <= -1.0) tmp = 1.0; elseif (y <= 13000.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.8e+44) tmp = 1.0; elseif (y <= -1.7e+38) tmp = x / y; elseif (y <= -1.0) tmp = 1.0; elseif (y <= 13000.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.8e+44], 1.0, If[LessEqual[y, -1.7e+38], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 13000.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.7 \cdot 10^{+38}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 13000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.8000000000000004e44 or -1.69999999999999998e38 < y < -1 or 13000 < y Initial program 100.0%
Taylor expanded in y around inf 77.9%
if -5.8000000000000004e44 < y < -1.69999999999999998e38Initial program 100.0%
Taylor expanded in x around inf 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -1 < y < 13000Initial program 100.0%
Taylor expanded in y around 0 76.0%
Final simplification77.3%
(FPCore (x y) :precision binary64 (if (or (<= y -2900000.0) (not (<= y 6600000.0))) (/ (+ x y) y) (/ x (+ y 1.0))))
double code(double x, double y) {
double tmp;
if ((y <= -2900000.0) || !(y <= 6600000.0)) {
tmp = (x + y) / y;
} else {
tmp = x / (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 <= (-2900000.0d0)) .or. (.not. (y <= 6600000.0d0))) then
tmp = (x + y) / y
else
tmp = x / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -2900000.0) || !(y <= 6600000.0)) {
tmp = (x + y) / y;
} else {
tmp = x / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2900000.0) or not (y <= 6600000.0): tmp = (x + y) / y else: tmp = x / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -2900000.0) || !(y <= 6600000.0)) tmp = Float64(Float64(x + y) / y); else tmp = Float64(x / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2900000.0) || ~((y <= 6600000.0))) tmp = (x + y) / y; else tmp = x / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2900000.0], N[Not[LessEqual[y, 6600000.0]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2900000 \lor \neg \left(y \leq 6600000\right):\\
\;\;\;\;\frac{x + y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + 1}\\
\end{array}
\end{array}
if y < -2.9e6 or 6.6e6 < y Initial program 100.0%
clear-num99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 98.9%
*-commutative98.9%
div-inv99.2%
+-commutative99.2%
Applied egg-rr99.2%
if -2.9e6 < y < 6.6e6Initial program 100.0%
Taylor expanded in x around inf 78.5%
+-commutative78.5%
Simplified78.5%
Final simplification88.5%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 13000.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 13000.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 <= 13000.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 <= 13000.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 13000.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 <= 13000.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 <= 13000.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, 13000.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 13000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 13000 < y Initial program 100.0%
Taylor expanded in y around inf 74.9%
if -1 < y < 13000Initial program 100.0%
Taylor expanded in y around 0 76.0%
Final simplification75.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 38.5%
Final simplification38.5%
herbie shell --seed 2023290
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))