
(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 -1.0) 1.0 (if (<= y -1.05e-135) y (if (<= y 2.7e-13) (- x (* x y)) 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -1.05e-135) {
tmp = y;
} else if (y <= 2.7e-13) {
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 <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= (-1.05d-135)) then
tmp = y
else if (y <= 2.7d-13) 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 <= -1.0) {
tmp = 1.0;
} else if (y <= -1.05e-135) {
tmp = y;
} else if (y <= 2.7e-13) {
tmp = x - (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= -1.05e-135: tmp = y elif y <= 2.7e-13: tmp = x - (x * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= -1.05e-135) tmp = y; elseif (y <= 2.7e-13) 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 <= -1.0) tmp = 1.0; elseif (y <= -1.05e-135) tmp = y; elseif (y <= 2.7e-13) tmp = x - (x * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, -1.05e-135], y, If[LessEqual[y, 2.7e-13], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-135}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-13}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 2.70000000000000011e-13 < y Initial program 100.0%
Taylor expanded in y around inf 73.1%
if -1 < y < -1.05e-135Initial program 100.0%
Taylor expanded in x around 0 73.0%
+-commutative73.0%
Simplified73.0%
Taylor expanded in y around 0 71.1%
if -1.05e-135 < y < 2.70000000000000011e-13Initial program 100.0%
Taylor expanded in x around inf 82.0%
+-commutative82.0%
Simplified82.0%
Taylor expanded in y around 0 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Final simplification76.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y -1.05e-135) y (if (<= y 3.1e+32) (/ x (+ y 1.0)) 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -1.05e-135) {
tmp = y;
} else if (y <= 3.1e+32) {
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 <= (-1.0d0)) then
tmp = 1.0d0
else if (y <= (-1.05d-135)) then
tmp = y
else if (y <= 3.1d+32) 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 <= -1.0) {
tmp = 1.0;
} else if (y <= -1.05e-135) {
tmp = y;
} else if (y <= 3.1e+32) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= -1.05e-135: tmp = y elif y <= 3.1e+32: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= -1.05e-135) tmp = y; elseif (y <= 3.1e+32) 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 <= -1.0) tmp = 1.0; elseif (y <= -1.05e-135) tmp = y; elseif (y <= 3.1e+32) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, -1.05e-135], y, If[LessEqual[y, 3.1e+32], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-135}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 3.09999999999999993e32 < y Initial program 100.0%
Taylor expanded in y around inf 77.2%
if -1 < y < -1.05e-135Initial program 100.0%
Taylor expanded in x around 0 73.0%
+-commutative73.0%
Simplified73.0%
Taylor expanded in y around 0 71.1%
if -1.05e-135 < y < 3.09999999999999993e32Initial program 100.0%
Taylor expanded in x around inf 79.4%
+-commutative79.4%
Simplified79.4%
Final simplification77.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x y))))
(if (<= y -7500.0)
t_0
(if (<= y -1.05e-135)
(/ y (+ y 1.0))
(if (<= y 2050000000.0) (/ x (+ y 1.0)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + (x / y);
double tmp;
if (y <= -7500.0) {
tmp = t_0;
} else if (y <= -1.05e-135) {
tmp = y / (y + 1.0);
} else if (y <= 2050000000.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 <= (-7500.0d0)) then
tmp = t_0
else if (y <= (-1.05d-135)) then
tmp = y / (y + 1.0d0)
else if (y <= 2050000000.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 <= -7500.0) {
tmp = t_0;
} else if (y <= -1.05e-135) {
tmp = y / (y + 1.0);
} else if (y <= 2050000000.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 <= -7500.0: tmp = t_0 elif y <= -1.05e-135: tmp = y / (y + 1.0) elif y <= 2050000000.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 <= -7500.0) tmp = t_0; elseif (y <= -1.05e-135) tmp = Float64(y / Float64(y + 1.0)); elseif (y <= 2050000000.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 <= -7500.0) tmp = t_0; elseif (y <= -1.05e-135) tmp = y / (y + 1.0); elseif (y <= 2050000000.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, -7500.0], t$95$0, If[LessEqual[y, -1.05e-135], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2050000000.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 -7500:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-135}:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 2050000000:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -7500 or 2.05e9 < y Initial program 100.0%
Taylor expanded in y around inf 99.2%
+-commutative99.2%
associate--l+99.2%
+-commutative99.2%
associate--r-99.2%
div-sub99.2%
Simplified99.2%
Taylor expanded in x around inf 98.8%
neg-mul-198.8%
distribute-neg-frac98.8%
Simplified98.8%
if -7500 < y < -1.05e-135Initial program 100.0%
Taylor expanded in x around 0 73.0%
+-commutative73.0%
Simplified73.0%
if -1.05e-135 < y < 2.05e9Initial program 100.0%
Taylor expanded in x around inf 80.1%
+-commutative80.1%
Simplified80.1%
Final simplification88.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.76))) (+ 1.0 (/ x y)) (* (+ x y) (- 1.0 y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.76)) {
tmp = 1.0 + (x / y);
} else {
tmp = (x + y) * (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)) .or. (.not. (y <= 0.76d0))) then
tmp = 1.0d0 + (x / y)
else
tmp = (x + y) * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.76)) {
tmp = 1.0 + (x / y);
} else {
tmp = (x + y) * (1.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.76): tmp = 1.0 + (x / y) else: tmp = (x + y) * (1.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.76)) tmp = Float64(1.0 + Float64(x / y)); else tmp = Float64(Float64(x + y) * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.76))) tmp = 1.0 + (x / y); else tmp = (x + y) * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.76]], $MachinePrecision]], N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.76\right):\\
\;\;\;\;1 + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -1 or 0.76000000000000001 < y Initial program 100.0%
Taylor expanded in y around inf 99.0%
+-commutative99.0%
associate--l+99.0%
+-commutative99.0%
associate--r-99.0%
div-sub99.0%
Simplified99.0%
Taylor expanded in x around inf 98.6%
neg-mul-198.6%
distribute-neg-frac98.6%
Simplified98.6%
if -1 < y < 0.76000000000000001Initial program 100.0%
flip-+100.0%
associate-/r/100.0%
metadata-eval100.0%
fma-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 99.5%
neg-mul-199.5%
neg-mul-199.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 99.6%
Simplified99.5%
Final simplification99.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- 1.0 (/ (- 1.0 x) y)) (* (+ x y) (- 1.0 y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 - ((1.0 - x) / y);
} else {
tmp = (x + y) * (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)) .or. (.not. (y <= 1.0d0))) then
tmp = 1.0d0 - ((1.0d0 - x) / y)
else
tmp = (x + y) * (1.0d0 - y)
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 - ((1.0 - x) / y);
} else {
tmp = (x + y) * (1.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = 1.0 - ((1.0 - x) / y) else: tmp = (x + y) * (1.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(1.0 - Float64(Float64(1.0 - x) / y)); else tmp = Float64(Float64(x + y) * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = 1.0 - ((1.0 - x) / y); else tmp = (x + y) * (1.0 - y); 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[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;1 - \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 99.0%
+-commutative99.0%
associate--l+99.0%
+-commutative99.0%
associate--r-99.0%
div-sub99.0%
Simplified99.0%
if -1 < y < 1Initial program 100.0%
flip-+100.0%
associate-/r/100.0%
metadata-eval100.0%
fma-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 99.5%
neg-mul-199.5%
neg-mul-199.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 99.6%
Simplified99.5%
Final simplification99.3%
(FPCore (x y) :precision binary64 (if (<= y -1.05e-135) (/ y (+ y 1.0)) (if (<= y 8.5e+31) (/ x (+ y 1.0)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.05e-135) {
tmp = y / (y + 1.0);
} else if (y <= 8.5e+31) {
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 <= (-1.05d-135)) then
tmp = y / (y + 1.0d0)
else if (y <= 8.5d+31) 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 <= -1.05e-135) {
tmp = y / (y + 1.0);
} else if (y <= 8.5e+31) {
tmp = x / (y + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.05e-135: tmp = y / (y + 1.0) elif y <= 8.5e+31: tmp = x / (y + 1.0) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.05e-135) tmp = Float64(y / Float64(y + 1.0)); elseif (y <= 8.5e+31) 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 <= -1.05e-135) tmp = y / (y + 1.0); elseif (y <= 8.5e+31) tmp = x / (y + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.05e-135], N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e+31], N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-135}:\\
\;\;\;\;\frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+31}:\\
\;\;\;\;\frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.05e-135Initial program 100.0%
Taylor expanded in x around 0 76.1%
+-commutative76.1%
Simplified76.1%
if -1.05e-135 < y < 8.49999999999999947e31Initial program 100.0%
Taylor expanded in x around inf 79.4%
+-commutative79.4%
Simplified79.4%
if 8.49999999999999947e31 < y Initial program 100.0%
Taylor expanded in y around inf 78.6%
Final simplification78.1%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y -6.2e-136) y (if (<= y 2.7e-13) x 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -6.2e-136) {
tmp = y;
} else if (y <= 2.7e-13) {
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-136)) then
tmp = y
else if (y <= 2.7d-13) 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-136) {
tmp = y;
} else if (y <= 2.7e-13) {
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-136: tmp = y elif y <= 2.7e-13: 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-136) tmp = y; elseif (y <= 2.7e-13) 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-136) tmp = y; elseif (y <= 2.7e-13) 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-136], y, If[LessEqual[y, 2.7e-13], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-136}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 2.70000000000000011e-13 < y Initial program 100.0%
Taylor expanded in y around inf 73.1%
if -1 < y < -6.2e-136Initial program 100.0%
Taylor expanded in x around 0 73.0%
+-commutative73.0%
Simplified73.0%
Taylor expanded in y around 0 71.1%
if -6.2e-136 < y < 2.70000000000000011e-13Initial program 100.0%
Taylor expanded in y around 0 82.0%
Final simplification76.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y 2.7e-13) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= 2.7e-13) {
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.7d-13) 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.7e-13) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= 2.7e-13: 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.7e-13) 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.7e-13) 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.7e-13], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 2.70000000000000011e-13 < y Initial program 100.0%
Taylor expanded in y around inf 73.1%
if -1 < y < 2.70000000000000011e-13Initial program 100.0%
Taylor expanded in y around 0 74.3%
Final simplification73.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 38.6%
Final simplification38.6%
herbie shell --seed 2024011
(FPCore (x y)
:name "Data.Colour.SRGB:invTransferFunction from colour-2.3.3"
:precision binary64
(/ (+ x y) (+ y 1.0)))