
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Initial program 100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.2e+71)
1.0
(if (<= y -1.0)
(/ x (- y))
(if (<= y -6.2e-69)
(* y (- -1.0 y))
(if (<= y 4.9e+30) (/ x (- 1.0 y)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.2e+71) {
tmp = 1.0;
} else if (y <= -1.0) {
tmp = x / -y;
} else if (y <= -6.2e-69) {
tmp = y * (-1.0 - y);
} else if (y <= 4.9e+30) {
tmp = x / (1.0 - 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.2d+71)) then
tmp = 1.0d0
else if (y <= (-1.0d0)) then
tmp = x / -y
else if (y <= (-6.2d-69)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 4.9d+30) then
tmp = x / (1.0d0 - y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.2e+71) {
tmp = 1.0;
} else if (y <= -1.0) {
tmp = x / -y;
} else if (y <= -6.2e-69) {
tmp = y * (-1.0 - y);
} else if (y <= 4.9e+30) {
tmp = x / (1.0 - y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.2e+71: tmp = 1.0 elif y <= -1.0: tmp = x / -y elif y <= -6.2e-69: tmp = y * (-1.0 - y) elif y <= 4.9e+30: tmp = x / (1.0 - y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.2e+71) tmp = 1.0; elseif (y <= -1.0) tmp = Float64(x / Float64(-y)); elseif (y <= -6.2e-69) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 4.9e+30) tmp = Float64(x / Float64(1.0 - y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.2e+71) tmp = 1.0; elseif (y <= -1.0) tmp = x / -y; elseif (y <= -6.2e-69) tmp = y * (-1.0 - y); elseif (y <= 4.9e+30) tmp = x / (1.0 - y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.2e+71], 1.0, If[LessEqual[y, -1.0], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, -6.2e-69], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e+30], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+71}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+30}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.1999999999999999e71 or 4.89999999999999984e30 < y Initial program 100.0%
Taylor expanded in y around inf 86.4%
if -1.1999999999999999e71 < y < -1Initial program 100.0%
Taylor expanded in x around inf 62.9%
Taylor expanded in y around inf 62.9%
associate-*r/62.9%
neg-mul-162.9%
Simplified62.9%
if -1 < y < -6.1999999999999999e-69Initial program 99.8%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-neg-frac286.3%
neg-sub086.3%
associate--r-86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in y around 0 86.5%
sub-neg86.5%
neg-mul-186.5%
distribute-neg-in86.5%
+-commutative86.5%
distribute-neg-in86.5%
metadata-eval86.5%
sub-neg86.5%
Simplified86.5%
if -6.1999999999999999e-69 < y < 4.89999999999999984e30Initial program 100.0%
Taylor expanded in x around inf 75.6%
Final simplification79.6%
(FPCore (x y)
:precision binary64
(if (<= y -1.26e+67)
1.0
(if (<= y -0.34)
(/ x (- y))
(if (<= y -1.8e-73) (* y (- -1.0 y)) (if (<= y 1.0) (+ x (* x y)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.26e+67) {
tmp = 1.0;
} else if (y <= -0.34) {
tmp = x / -y;
} else if (y <= -1.8e-73) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
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.26d+67)) then
tmp = 1.0d0
else if (y <= (-0.34d0)) then
tmp = x / -y
else if (y <= (-1.8d-73)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 1.0d0) 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.26e+67) {
tmp = 1.0;
} else if (y <= -0.34) {
tmp = x / -y;
} else if (y <= -1.8e-73) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x + (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.26e+67: tmp = 1.0 elif y <= -0.34: tmp = x / -y elif y <= -1.8e-73: tmp = y * (-1.0 - y) elif y <= 1.0: tmp = x + (x * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.26e+67) tmp = 1.0; elseif (y <= -0.34) tmp = Float64(x / Float64(-y)); elseif (y <= -1.8e-73) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 1.0) 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.26e+67) tmp = 1.0; elseif (y <= -0.34) tmp = x / -y; elseif (y <= -1.8e-73) tmp = y * (-1.0 - y); elseif (y <= 1.0) tmp = x + (x * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.26e+67], 1.0, If[LessEqual[y, -0.34], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, -1.8e-73], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.26 \cdot 10^{+67}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -0.34:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-73}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.26e67 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 84.1%
if -1.26e67 < y < -0.340000000000000024Initial program 100.0%
Taylor expanded in x around inf 62.9%
Taylor expanded in y around inf 62.9%
associate-*r/62.9%
neg-mul-162.9%
Simplified62.9%
if -0.340000000000000024 < y < -1.8e-73Initial program 99.8%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-neg-frac286.3%
neg-sub086.3%
associate--r-86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in y around 0 86.5%
sub-neg86.5%
neg-mul-186.5%
distribute-neg-in86.5%
+-commutative86.5%
distribute-neg-in86.5%
metadata-eval86.5%
sub-neg86.5%
Simplified86.5%
if -1.8e-73 < y < 1Initial program 100.0%
Taylor expanded in x around inf 76.3%
Taylor expanded in y around 0 76.3%
*-commutative76.3%
Simplified76.3%
Final simplification79.1%
(FPCore (x y)
:precision binary64
(if (<= y -7.6e+66)
1.0
(if (<= y -3.1)
(/ x (- y))
(if (<= y 6.8e-10) (+ x (* y (+ x -1.0))) (/ y (+ y -1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -7.6e+66) {
tmp = 1.0;
} else if (y <= -3.1) {
tmp = x / -y;
} else if (y <= 6.8e-10) {
tmp = x + (y * (x + -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 <= (-7.6d+66)) then
tmp = 1.0d0
else if (y <= (-3.1d0)) then
tmp = x / -y
else if (y <= 6.8d-10) then
tmp = x + (y * (x + (-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 <= -7.6e+66) {
tmp = 1.0;
} else if (y <= -3.1) {
tmp = x / -y;
} else if (y <= 6.8e-10) {
tmp = x + (y * (x + -1.0));
} else {
tmp = y / (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.6e+66: tmp = 1.0 elif y <= -3.1: tmp = x / -y elif y <= 6.8e-10: tmp = x + (y * (x + -1.0)) else: tmp = y / (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.6e+66) tmp = 1.0; elseif (y <= -3.1) tmp = Float64(x / Float64(-y)); elseif (y <= 6.8e-10) tmp = Float64(x + Float64(y * Float64(x + -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 <= -7.6e+66) tmp = 1.0; elseif (y <= -3.1) tmp = x / -y; elseif (y <= 6.8e-10) tmp = x + (y * (x + -1.0)); else tmp = y / (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.6e+66], 1.0, If[LessEqual[y, -3.1], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, 6.8e-10], N[(x + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+66}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3.1:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-10}:\\
\;\;\;\;x + y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -1}\\
\end{array}
\end{array}
if y < -7.6000000000000004e66Initial program 100.0%
Taylor expanded in y around inf 91.3%
if -7.6000000000000004e66 < y < -3.10000000000000009Initial program 100.0%
Taylor expanded in x around inf 62.9%
Taylor expanded in y around inf 62.9%
associate-*r/62.9%
neg-mul-162.9%
Simplified62.9%
if -3.10000000000000009 < y < 6.8000000000000003e-10Initial program 100.0%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
unsub-neg99.6%
mul-1-neg99.6%
sub-neg99.6%
Simplified99.6%
if 6.8000000000000003e-10 < y Initial program 100.0%
Taylor expanded in x around 0 79.6%
neg-mul-179.6%
distribute-neg-frac279.6%
neg-sub079.6%
associate--r-79.6%
metadata-eval79.6%
Simplified79.6%
Final simplification90.5%
(FPCore (x y)
:precision binary64
(if (<= y -7.6e+66)
1.0
(if (<= y -1.0)
(/ x (- y))
(if (<= y -1.5e-69) (* y (- -1.0 y)) (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -7.6e+66) {
tmp = 1.0;
} else if (y <= -1.0) {
tmp = x / -y;
} else if (y <= -1.5e-69) {
tmp = y * (-1.0 - y);
} else if (y <= 1.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 <= (-7.6d+66)) then
tmp = 1.0d0
else if (y <= (-1.0d0)) then
tmp = x / -y
else if (y <= (-1.5d-69)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 1.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 <= -7.6e+66) {
tmp = 1.0;
} else if (y <= -1.0) {
tmp = x / -y;
} else if (y <= -1.5e-69) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.6e+66: tmp = 1.0 elif y <= -1.0: tmp = x / -y elif y <= -1.5e-69: tmp = y * (-1.0 - y) elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.6e+66) tmp = 1.0; elseif (y <= -1.0) tmp = Float64(x / Float64(-y)); elseif (y <= -1.5e-69) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.6e+66) tmp = 1.0; elseif (y <= -1.0) tmp = x / -y; elseif (y <= -1.5e-69) tmp = y * (-1.0 - y); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.6e+66], 1.0, If[LessEqual[y, -1.0], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, -1.5e-69], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+66}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-69}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.6000000000000004e66 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 84.1%
if -7.6000000000000004e66 < y < -1Initial program 100.0%
Taylor expanded in x around inf 62.9%
Taylor expanded in y around inf 62.9%
associate-*r/62.9%
neg-mul-162.9%
Simplified62.9%
if -1 < y < -1.49999999999999995e-69Initial program 99.8%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-neg-frac286.3%
neg-sub086.3%
associate--r-86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in y around 0 86.5%
sub-neg86.5%
neg-mul-186.5%
distribute-neg-in86.5%
+-commutative86.5%
distribute-neg-in86.5%
metadata-eval86.5%
sub-neg86.5%
Simplified86.5%
if -1.49999999999999995e-69 < y < 1Initial program 100.0%
Taylor expanded in y around 0 76.0%
Final simplification79.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.85e+70)
1.0
(if (<= y -0.122)
(/ x (- y))
(if (<= y -7.8e-69) (- y) (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -1.85e+70) {
tmp = 1.0;
} else if (y <= -0.122) {
tmp = x / -y;
} else if (y <= -7.8e-69) {
tmp = -y;
} else if (y <= 1.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.85d+70)) then
tmp = 1.0d0
else if (y <= (-0.122d0)) then
tmp = x / -y
else if (y <= (-7.8d-69)) then
tmp = -y
else if (y <= 1.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.85e+70) {
tmp = 1.0;
} else if (y <= -0.122) {
tmp = x / -y;
} else if (y <= -7.8e-69) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.85e+70: tmp = 1.0 elif y <= -0.122: tmp = x / -y elif y <= -7.8e-69: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.85e+70) tmp = 1.0; elseif (y <= -0.122) tmp = Float64(x / Float64(-y)); elseif (y <= -7.8e-69) tmp = Float64(-y); elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.85e+70) tmp = 1.0; elseif (y <= -0.122) tmp = x / -y; elseif (y <= -7.8e-69) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.85e+70], 1.0, If[LessEqual[y, -0.122], N[(x / (-y)), $MachinePrecision], If[LessEqual[y, -7.8e-69], (-y), If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{+70}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -0.122:\\
\;\;\;\;\frac{x}{-y}\\
\mathbf{elif}\;y \leq -7.8 \cdot 10^{-69}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.84999999999999994e70 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 84.1%
if -1.84999999999999994e70 < y < -0.122Initial program 100.0%
Taylor expanded in x around inf 62.9%
Taylor expanded in y around inf 62.9%
associate-*r/62.9%
neg-mul-162.9%
Simplified62.9%
if -0.122 < y < -7.79999999999999961e-69Initial program 99.8%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-neg-frac286.3%
neg-sub086.3%
associate--r-86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in y around 0 83.4%
neg-mul-183.4%
Simplified83.4%
if -7.79999999999999961e-69 < y < 1Initial program 100.0%
Taylor expanded in y around 0 76.0%
Final simplification78.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y -1.12e-69) (- y) (if (<= y 1.0) x 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -1.12e-69) {
tmp = -y;
} else if (y <= 1.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 <= (-1.12d-69)) then
tmp = -y
else if (y <= 1.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 <= -1.12e-69) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= -1.12e-69: tmp = -y elif y <= 1.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 <= -1.12e-69) tmp = Float64(-y); elseif (y <= 1.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 <= -1.12e-69) tmp = -y; elseif (y <= 1.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, -1.12e-69], (-y), If[LessEqual[y, 1.0], x, 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-69}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 77.3%
if -1 < y < -1.12e-69Initial program 99.8%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-neg-frac286.3%
neg-sub086.3%
associate--r-86.3%
metadata-eval86.3%
Simplified86.3%
Taylor expanded in y around 0 83.4%
neg-mul-183.4%
Simplified83.4%
if -1.12e-69 < y < 1Initial program 100.0%
Taylor expanded in y around 0 76.0%
(FPCore (x y) :precision binary64 (if (or (<= y -4.5e-74) (not (<= y 4.1e-10))) (/ y (+ y -1.0)) (+ x (* x y))))
double code(double x, double y) {
double tmp;
if ((y <= -4.5e-74) || !(y <= 4.1e-10)) {
tmp = y / (y + -1.0);
} else {
tmp = x + (x * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-4.5d-74)) .or. (.not. (y <= 4.1d-10))) then
tmp = y / (y + (-1.0d0))
else
tmp = x + (x * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -4.5e-74) || !(y <= 4.1e-10)) {
tmp = y / (y + -1.0);
} else {
tmp = x + (x * y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -4.5e-74) or not (y <= 4.1e-10): tmp = y / (y + -1.0) else: tmp = x + (x * y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -4.5e-74) || !(y <= 4.1e-10)) tmp = Float64(y / Float64(y + -1.0)); else tmp = Float64(x + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -4.5e-74) || ~((y <= 4.1e-10))) tmp = y / (y + -1.0); else tmp = x + (x * y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -4.5e-74], N[Not[LessEqual[y, 4.1e-10]], $MachinePrecision]], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-74} \lor \neg \left(y \leq 4.1 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot y\\
\end{array}
\end{array}
if y < -4.4999999999999999e-74 or 4.0999999999999998e-10 < y Initial program 100.0%
Taylor expanded in x around 0 78.5%
neg-mul-178.5%
distribute-neg-frac278.5%
neg-sub078.5%
associate--r-78.5%
metadata-eval78.5%
Simplified78.5%
if -4.4999999999999999e-74 < y < 4.0999999999999998e-10Initial program 100.0%
Taylor expanded in x around inf 76.9%
Taylor expanded in y around 0 77.0%
*-commutative77.0%
Simplified77.0%
Final simplification77.8%
(FPCore (x y) :precision binary64 (if (<= y -3.4e-13) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -3.4e-13) {
tmp = 1.0;
} else if (y <= 1.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 <= (-3.4d-13)) then
tmp = 1.0d0
else if (y <= 1.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 <= -3.4e-13) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.4e-13: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.4e-13) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.4e-13) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.4e-13], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-13}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.40000000000000015e-13 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 76.2%
if -3.40000000000000015e-13 < y < 1Initial program 100.0%
Taylor expanded in y around 0 70.9%
(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 39.9%
herbie shell --seed 2024157
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))