
(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 10 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 -7.2e+131)
1.0
(if (<= y -1.12e+75)
(/ x y)
(if (<= y -1.0) 1.0 (if (<= y 0.096) (- x (* x y)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -7.2e+131) {
tmp = 1.0;
} else if (y <= -1.12e+75) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.096) {
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 <= (-7.2d+131)) then
tmp = 1.0d0
else if (y <= (-1.12d+75)) then
tmp = x / y
else if (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= 0.096d0) 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 <= -7.2e+131) {
tmp = 1.0;
} else if (y <= -1.12e+75) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.096) {
tmp = x - (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.2e+131: tmp = 1.0 elif y <= -1.12e+75: tmp = x / y elif y <= -1.0: tmp = 1.0 elif y <= 0.096: tmp = x - (x * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.2e+131) tmp = 1.0; elseif (y <= -1.12e+75) tmp = Float64(x / y); elseif (y <= -1.0) tmp = 1.0; elseif (y <= 0.096) 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 <= -7.2e+131) tmp = 1.0; elseif (y <= -1.12e+75) tmp = x / y; elseif (y <= -1.0) tmp = 1.0; elseif (y <= 0.096) tmp = x - (x * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.2e+131], 1.0, If[LessEqual[y, -1.12e+75], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 0.096], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+131}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{+75}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 0.096:\\
\;\;\;\;x - x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.20000000000000063e131 or -1.12000000000000001e75 < y < -1 or 0.096000000000000002 < y Initial program 100.0%
Taylor expanded in y around inf 78.4%
if -7.20000000000000063e131 < y < -1.12000000000000001e75Initial program 99.7%
Taylor expanded in x around inf 90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in y around inf 90.6%
if -1 < y < 0.096000000000000002Initial program 100.0%
Taylor expanded in x around inf 79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in y around 0 79.4%
mul-1-neg79.4%
unsub-neg79.4%
*-commutative79.4%
Simplified79.4%
Final simplification79.2%
(FPCore (x y)
:precision binary64
(if (<= y -6.8e+131)
1.0
(if (<= y -3e+76)
(/ x y)
(if (<= y -7800.0) 1.0 (if (<= y 3e+14) (/ x (+ y 1.0)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -6.8e+131) {
tmp = 1.0;
} else if (y <= -3e+76) {
tmp = x / y;
} else if (y <= -7800.0) {
tmp = 1.0;
} else if (y <= 3e+14) {
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.8d+131)) then
tmp = 1.0d0
else if (y <= (-3d+76)) then
tmp = x / y
else if (y <= (-7800.0d0)) then
tmp = 1.0d0
else if (y <= 3d+14) 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.8e+131) {
tmp = 1.0;
} else if (y <= -3e+76) {
tmp = x / y;
} else if (y <= -7800.0) {
tmp = 1.0;
} else if (y <= 3e+14) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.8e+131: tmp = 1.0 elif y <= -3e+76: tmp = x / y elif y <= -7800.0: tmp = 1.0 elif y <= 3e+14: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6.8e+131) tmp = 1.0; elseif (y <= -3e+76) tmp = Float64(x / y); elseif (y <= -7800.0) tmp = 1.0; elseif (y <= 3e+14) 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.8e+131) tmp = 1.0; elseif (y <= -3e+76) tmp = x / y; elseif (y <= -7800.0) tmp = 1.0; elseif (y <= 3e+14) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.8e+131], 1.0, If[LessEqual[y, -3e+76], N[(x / y), $MachinePrecision], If[LessEqual[y, -7800.0], 1.0, If[LessEqual[y, 3e+14], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+131}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3 \cdot 10^{+76}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -7800:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.79999999999999972e131 or -2.9999999999999998e76 < y < -7800 or 3e14 < y Initial program 100.0%
Taylor expanded in y around inf 80.1%
if -6.79999999999999972e131 < y < -2.9999999999999998e76Initial program 99.7%
Taylor expanded in x around inf 90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in y around inf 90.6%
if -7800 < y < 3e14Initial program 100.0%
Taylor expanded in x around inf 77.9%
+-commutative77.9%
Simplified77.9%
Final simplification79.3%
(FPCore (x y) :precision binary64 (if (<= y -6.8e+131) 1.0 (if (<= y -7.6e+76) (/ x y) (if (<= y -1.0) 1.0 (if (<= y 0.025) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -6.8e+131) {
tmp = 1.0;
} else if (y <= -7.6e+76) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.025) {
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 <= (-6.8d+131)) then
tmp = 1.0d0
else if (y <= (-7.6d+76)) then
tmp = x / y
else if (y <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= 0.025d0) 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 <= -6.8e+131) {
tmp = 1.0;
} else if (y <= -7.6e+76) {
tmp = x / y;
} else if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.025) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.8e+131: tmp = 1.0 elif y <= -7.6e+76: tmp = x / y elif y <= -1.0: tmp = 1.0 elif y <= 0.025: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6.8e+131) tmp = 1.0; elseif (y <= -7.6e+76) tmp = Float64(x / y); elseif (y <= -1.0) tmp = 1.0; elseif (y <= 0.025) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6.8e+131) tmp = 1.0; elseif (y <= -7.6e+76) tmp = x / y; elseif (y <= -1.0) tmp = 1.0; elseif (y <= 0.025) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.8e+131], 1.0, If[LessEqual[y, -7.6e+76], N[(x / y), $MachinePrecision], If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 0.025], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+131}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -7.6 \cdot 10^{+76}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 0.025:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.79999999999999972e131 or -7.60000000000000049e76 < y < -1 or 0.025000000000000001 < y Initial program 100.0%
Taylor expanded in y around inf 78.4%
if -6.79999999999999972e131 < y < -7.60000000000000049e76Initial program 99.7%
Taylor expanded in x around inf 90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in y around inf 90.6%
if -1 < y < 0.025000000000000001Initial program 100.0%
Taylor expanded in y around 0 78.3%
Final simplification78.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.8))) (+ 1.0 (/ x y)) (- x (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.8)) {
tmp = 1.0 + (x / y);
} else {
tmp = x - (y * (x + -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)) .or. (.not. (y <= 0.8d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = x - (y * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.8)) {
tmp = 1.0 + (x / y);
} else {
tmp = x - (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.8): tmp = 1.0 + (x / y) else: tmp = x - (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.8)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(x - Float64(y * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.8))) tmp = 1.0 + (x / y); else tmp = x - (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.8]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.8\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 0.80000000000000004 < y Initial program 100.0%
Taylor expanded in y around inf 98.8%
+-commutative98.8%
associate--l+98.8%
+-commutative98.8%
associate--r-98.8%
div-sub98.8%
Simplified98.8%
Taylor expanded in x around inf 97.8%
neg-mul-197.8%
distribute-neg-frac97.8%
Simplified97.8%
if -1 < y < 0.80000000000000004Initial program 100.0%
Taylor expanded in y around 0 99.0%
Final simplification98.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ 1.0 (/ (+ x -1.0) y)) (- x (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x - (y * (x + -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)) .or. (.not. (y <= 1.0d0))) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else
tmp = x - (y * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x - (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = 1.0 + ((x + -1.0) / y) else: tmp = x - (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); else tmp = Float64(x - Float64(y * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = 1.0 + ((x + -1.0) / y); else tmp = x - (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 98.8%
+-commutative98.8%
associate--l+98.8%
+-commutative98.8%
associate--r-98.8%
div-sub98.8%
Simplified98.8%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0 99.0%
Final simplification98.9%
(FPCore (x y) :precision binary64 (if (or (<= x -1.65e+79) (not (<= x 1.02e-23))) (/ x (+ y 1.0)) (/ y (+ y 1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -1.65e+79) || !(x <= 1.02e-23)) {
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 ((x <= (-1.65d+79)) .or. (.not. (x <= 1.02d-23))) 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 ((x <= -1.65e+79) || !(x <= 1.02e-23)) {
tmp = x / (y + 1.0);
} else {
tmp = y / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.65e+79) or not (x <= 1.02e-23): tmp = x / (y + 1.0) else: tmp = y / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.65e+79) || !(x <= 1.02e-23)) 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 ((x <= -1.65e+79) || ~((x <= 1.02e-23))) tmp = x / (y + 1.0); else tmp = y / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.65e+79], N[Not[LessEqual[x, 1.02e-23]], $MachinePrecision]], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+79} \lor \neg \left(x \leq 1.02 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + 1}\\
\end{array}
\end{array}
if x < -1.6500000000000001e79 or 1.02000000000000005e-23 < x Initial program 100.0%
Taylor expanded in x around inf 79.6%
+-commutative79.6%
Simplified79.6%
if -1.6500000000000001e79 < x < 1.02000000000000005e-23Initial program 100.0%
Taylor expanded in x around 0 82.6%
+-commutative82.6%
Simplified82.6%
Final simplification81.1%
(FPCore (x y) :precision binary64 (if (or (<= y -7600.0) (not (<= y 0.096))) (+ 1.0 (/ x y)) (/ x (+ y 1.0))))
double code(double x, double y) {
double tmp;
if ((y <= -7600.0) || !(y <= 0.096)) {
tmp = 1.0 + (x / 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 <= (-7600.0d0)) .or. (.not. (y <= 0.096d0))) then
tmp = 1.0d0 + (x / 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 <= -7600.0) || !(y <= 0.096)) {
tmp = 1.0 + (x / y);
} else {
tmp = x / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7600.0) or not (y <= 0.096): tmp = 1.0 + (x / y) else: tmp = x / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -7600.0) || !(y <= 0.096)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(x / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -7600.0) || ~((y <= 0.096))) tmp = 1.0 + (x / y); else tmp = x / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7600.0], N[Not[LessEqual[y, 0.096]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7600 \lor \neg \left(y \leq 0.096\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + 1}\\
\end{array}
\end{array}
if y < -7600 or 0.096000000000000002 < y Initial program 100.0%
Taylor expanded in y around inf 98.1%
+-commutative98.1%
associate--l+98.1%
+-commutative98.1%
associate--r-98.1%
div-sub98.1%
Simplified98.1%
Taylor expanded in x around inf 97.2%
neg-mul-197.2%
distribute-neg-frac97.2%
Simplified97.2%
if -7600 < y < 0.096000000000000002Initial program 100.0%
Taylor expanded in x around inf 79.6%
+-commutative79.6%
Simplified79.6%
Final simplification89.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 0.096) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 0.096) {
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 <= 0.096d0) 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 <= 0.096) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 0.096: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= 0.096) 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 <= 0.096) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, 0.096], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 0.096:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 0.096000000000000002 < y Initial program 100.0%
Taylor expanded in y around inf 75.3%
if -1 < y < 0.096000000000000002Initial program 100.0%
Taylor expanded in y around 0 78.3%
Final simplification76.7%
(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 43.0%
Final simplification43.0%
herbie shell --seed 2024026
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))