
(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 9 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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
1.0
(if (<= y -2.5e-36)
(- y)
(if (<= y 1.0)
x
(if (<= y 1.42e+65) 1.0 (if (<= y 6.5e+103) (/ (- x) y) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = 1.0;
} else if (y <= -2.5e-36) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else if (y <= 1.42e+65) {
tmp = 1.0;
} else if (y <= 6.5e+103) {
tmp = -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 <= (-2.5d-36)) then
tmp = -y
else if (y <= 1.0d0) then
tmp = x
else if (y <= 1.42d+65) then
tmp = 1.0d0
else if (y <= 6.5d+103) then
tmp = -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 <= -2.5e-36) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else if (y <= 1.42e+65) {
tmp = 1.0;
} else if (y <= 6.5e+103) {
tmp = -x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = 1.0 elif y <= -2.5e-36: tmp = -y elif y <= 1.0: tmp = x elif y <= 1.42e+65: tmp = 1.0 elif y <= 6.5e+103: tmp = -x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = 1.0; elseif (y <= -2.5e-36) tmp = Float64(-y); elseif (y <= 1.0) tmp = x; elseif (y <= 1.42e+65) tmp = 1.0; elseif (y <= 6.5e+103) tmp = Float64(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 <= -2.5e-36) tmp = -y; elseif (y <= 1.0) tmp = x; elseif (y <= 1.42e+65) tmp = 1.0; elseif (y <= 6.5e+103) tmp = -x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], 1.0, If[LessEqual[y, -2.5e-36], (-y), If[LessEqual[y, 1.0], x, If[LessEqual[y, 1.42e+65], 1.0, If[LessEqual[y, 6.5e+103], N[((-x) / y), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-36}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{+65}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+103}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 1 < y < 1.42000000000000012e65 or 6.50000000000000001e103 < y Initial program 100.0%
Taylor expanded in y around inf 77.1%
if -1 < y < -2.50000000000000002e-36Initial program 99.7%
Taylor expanded in x around 0 89.8%
neg-mul-189.8%
distribute-neg-frac289.8%
neg-sub089.8%
associate--r-89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in y around 0 78.9%
mul-1-neg78.9%
Simplified78.9%
if -2.50000000000000002e-36 < y < 1Initial program 100.0%
Taylor expanded in y around 0 80.9%
if 1.42000000000000012e65 < y < 6.50000000000000001e103Initial program 100.0%
Taylor expanded in x around inf 84.1%
Taylor expanded in y around inf 84.1%
neg-mul-184.1%
distribute-neg-frac84.1%
Simplified84.1%
Final simplification79.2%
(FPCore (x y)
:precision binary64
(if (<= y -31000.0)
1.0
(if (<= y -3.8e-33)
(* y (- -1.0 y))
(if (<= y 1.0)
x
(if (<= y 5.2e+64) 1.0 (if (<= y 2.8e+104) (/ (- x) y) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -31000.0) {
tmp = 1.0;
} else if (y <= -3.8e-33) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else if (y <= 5.2e+64) {
tmp = 1.0;
} else if (y <= 2.8e+104) {
tmp = -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 <= (-31000.0d0)) then
tmp = 1.0d0
else if (y <= (-3.8d-33)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 1.0d0) then
tmp = x
else if (y <= 5.2d+64) then
tmp = 1.0d0
else if (y <= 2.8d+104) then
tmp = -x / y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -31000.0) {
tmp = 1.0;
} else if (y <= -3.8e-33) {
tmp = y * (-1.0 - y);
} else if (y <= 1.0) {
tmp = x;
} else if (y <= 5.2e+64) {
tmp = 1.0;
} else if (y <= 2.8e+104) {
tmp = -x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -31000.0: tmp = 1.0 elif y <= -3.8e-33: tmp = y * (-1.0 - y) elif y <= 1.0: tmp = x elif y <= 5.2e+64: tmp = 1.0 elif y <= 2.8e+104: tmp = -x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -31000.0) tmp = 1.0; elseif (y <= -3.8e-33) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 1.0) tmp = x; elseif (y <= 5.2e+64) tmp = 1.0; elseif (y <= 2.8e+104) tmp = Float64(Float64(-x) / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -31000.0) tmp = 1.0; elseif (y <= -3.8e-33) tmp = y * (-1.0 - y); elseif (y <= 1.0) tmp = x; elseif (y <= 5.2e+64) tmp = 1.0; elseif (y <= 2.8e+104) tmp = -x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -31000.0], 1.0, If[LessEqual[y, -3.8e-33], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], x, If[LessEqual[y, 5.2e+64], 1.0, If[LessEqual[y, 2.8e+104], N[((-x) / y), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -31000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-33}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+64}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+104}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -31000 or 1 < y < 5.19999999999999994e64 or 2.8e104 < y Initial program 100.0%
Taylor expanded in y around inf 77.7%
if -31000 < y < -3.79999999999999994e-33Initial program 99.7%
Taylor expanded in x around 0 81.7%
neg-mul-181.7%
distribute-neg-frac281.7%
neg-sub081.7%
associate--r-81.7%
metadata-eval81.7%
Simplified81.7%
Taylor expanded in y around 0 82.1%
sub-neg82.1%
mul-1-neg82.1%
metadata-eval82.1%
+-commutative82.1%
unsub-neg82.1%
Simplified82.1%
if -3.79999999999999994e-33 < y < 1Initial program 100.0%
Taylor expanded in y around 0 80.9%
if 5.19999999999999994e64 < y < 2.8e104Initial program 100.0%
Taylor expanded in x around inf 84.1%
Taylor expanded in y around inf 84.1%
neg-mul-184.1%
distribute-neg-frac84.1%
Simplified84.1%
Final simplification79.7%
(FPCore (x y)
:precision binary64
(if (<= y -31000.0)
1.0
(if (<= y -3.8e-35)
(* y (- -1.0 y))
(if (<= y 960000000000.0)
(/ x (- 1.0 y))
(if (<= y 6.4e+64) 1.0 (if (<= y 1.25e+103) (/ (- x) y) 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -31000.0) {
tmp = 1.0;
} else if (y <= -3.8e-35) {
tmp = y * (-1.0 - y);
} else if (y <= 960000000000.0) {
tmp = x / (1.0 - y);
} else if (y <= 6.4e+64) {
tmp = 1.0;
} else if (y <= 1.25e+103) {
tmp = -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 <= (-31000.0d0)) then
tmp = 1.0d0
else if (y <= (-3.8d-35)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 960000000000.0d0) then
tmp = x / (1.0d0 - y)
else if (y <= 6.4d+64) then
tmp = 1.0d0
else if (y <= 1.25d+103) then
tmp = -x / y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -31000.0) {
tmp = 1.0;
} else if (y <= -3.8e-35) {
tmp = y * (-1.0 - y);
} else if (y <= 960000000000.0) {
tmp = x / (1.0 - y);
} else if (y <= 6.4e+64) {
tmp = 1.0;
} else if (y <= 1.25e+103) {
tmp = -x / y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -31000.0: tmp = 1.0 elif y <= -3.8e-35: tmp = y * (-1.0 - y) elif y <= 960000000000.0: tmp = x / (1.0 - y) elif y <= 6.4e+64: tmp = 1.0 elif y <= 1.25e+103: tmp = -x / y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -31000.0) tmp = 1.0; elseif (y <= -3.8e-35) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 960000000000.0) tmp = Float64(x / Float64(1.0 - y)); elseif (y <= 6.4e+64) tmp = 1.0; elseif (y <= 1.25e+103) tmp = Float64(Float64(-x) / y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -31000.0) tmp = 1.0; elseif (y <= -3.8e-35) tmp = y * (-1.0 - y); elseif (y <= 960000000000.0) tmp = x / (1.0 - y); elseif (y <= 6.4e+64) tmp = 1.0; elseif (y <= 1.25e+103) tmp = -x / y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -31000.0], 1.0, If[LessEqual[y, -3.8e-35], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 960000000000.0], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e+64], 1.0, If[LessEqual[y, 1.25e+103], N[((-x) / y), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -31000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-35}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 960000000000:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+64}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+103}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -31000 or 9.6e11 < y < 6.40000000000000037e64 or 1.25e103 < y Initial program 100.0%
Taylor expanded in y around inf 80.3%
if -31000 < y < -3.8000000000000001e-35Initial program 99.7%
Taylor expanded in x around 0 81.7%
neg-mul-181.7%
distribute-neg-frac281.7%
neg-sub081.7%
associate--r-81.7%
metadata-eval81.7%
Simplified81.7%
Taylor expanded in y around 0 82.1%
sub-neg82.1%
mul-1-neg82.1%
metadata-eval82.1%
+-commutative82.1%
unsub-neg82.1%
Simplified82.1%
if -3.8000000000000001e-35 < y < 9.6e11Initial program 100.0%
Taylor expanded in x around inf 81.7%
if 6.40000000000000037e64 < y < 1.25e103Initial program 100.0%
Taylor expanded in x around inf 84.1%
Taylor expanded in y around inf 84.1%
neg-mul-184.1%
distribute-neg-frac84.1%
Simplified84.1%
Final simplification81.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (- 1.0 x) y))))
(if (<= y -0.98)
t_0
(if (<= y -1.6e-39)
(* y (- -1.0 y))
(if (<= y 31.5) (/ x (- 1.0 y)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -0.98) {
tmp = t_0;
} else if (y <= -1.6e-39) {
tmp = y * (-1.0 - y);
} else if (y <= 31.5) {
tmp = x / (1.0 - y);
} 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 + ((1.0d0 - x) / y)
if (y <= (-0.98d0)) then
tmp = t_0
else if (y <= (-1.6d-39)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 31.5d0) then
tmp = x / (1.0d0 - y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -0.98) {
tmp = t_0;
} else if (y <= -1.6e-39) {
tmp = y * (-1.0 - y);
} else if (y <= 31.5) {
tmp = x / (1.0 - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((1.0 - x) / y) tmp = 0 if y <= -0.98: tmp = t_0 elif y <= -1.6e-39: tmp = y * (-1.0 - y) elif y <= 31.5: tmp = x / (1.0 - y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(1.0 - x) / y)) tmp = 0.0 if (y <= -0.98) tmp = t_0; elseif (y <= -1.6e-39) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 31.5) tmp = Float64(x / Float64(1.0 - y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((1.0 - x) / y); tmp = 0.0; if (y <= -0.98) tmp = t_0; elseif (y <= -1.6e-39) tmp = y * (-1.0 - y); elseif (y <= 31.5) tmp = x / (1.0 - y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.98], t$95$0, If[LessEqual[y, -1.6e-39], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 31.5], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -0.98:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-39}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 31.5:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.97999999999999998 or 31.5 < y Initial program 100.0%
Taylor expanded in y around inf 98.7%
+-commutative98.7%
mul-1-neg98.7%
sub-neg98.7%
div-sub98.7%
Simplified98.7%
if -0.97999999999999998 < y < -1.5999999999999999e-39Initial program 99.7%
Taylor expanded in x around 0 89.8%
neg-mul-189.8%
distribute-neg-frac289.8%
neg-sub089.8%
associate--r-89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in y around 0 89.9%
sub-neg89.9%
mul-1-neg89.9%
metadata-eval89.9%
+-commutative89.9%
unsub-neg89.9%
Simplified89.9%
if -1.5999999999999999e-39 < y < 31.5Initial program 100.0%
Taylor expanded in x around inf 82.2%
Final simplification90.4%
(FPCore (x y) :precision binary64 (if (<= y -1.0) 1.0 (if (<= y -1.5e-35) (- 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.5e-35) {
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.5d-35)) 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.5e-35) {
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.5e-35: 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.5e-35) 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.5e-35) 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.5e-35], (-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.5 \cdot 10^{-35}:\\
\;\;\;\;-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 72.5%
if -1 < y < -1.49999999999999994e-35Initial program 99.7%
Taylor expanded in x around 0 89.8%
neg-mul-189.8%
distribute-neg-frac289.8%
neg-sub089.8%
associate--r-89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in y around 0 78.9%
mul-1-neg78.9%
Simplified78.9%
if -1.49999999999999994e-35 < y < 1Initial program 100.0%
Taylor expanded in y around 0 80.9%
Final simplification76.7%
(FPCore (x y) :precision binary64 (if (or (<= x -3.2e+67) (not (<= x 7.8e-63))) (/ x (- 1.0 y)) (/ y (+ y -1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -3.2e+67) || !(x <= 7.8e-63)) {
tmp = x / (1.0 - y);
} 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 <= (-3.2d+67)) .or. (.not. (x <= 7.8d-63))) then
tmp = x / (1.0d0 - y)
else
tmp = y / (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -3.2e+67) || !(x <= 7.8e-63)) {
tmp = x / (1.0 - y);
} else {
tmp = y / (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3.2e+67) or not (x <= 7.8e-63): tmp = x / (1.0 - y) else: tmp = y / (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -3.2e+67) || !(x <= 7.8e-63)) tmp = Float64(x / Float64(1.0 - y)); else tmp = Float64(y / Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3.2e+67) || ~((x <= 7.8e-63))) tmp = x / (1.0 - y); else tmp = y / (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3.2e+67], N[Not[LessEqual[x, 7.8e-63]], $MachinePrecision]], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+67} \lor \neg \left(x \leq 7.8 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -1}\\
\end{array}
\end{array}
if x < -3.19999999999999983e67 or 7.80000000000000044e-63 < x Initial program 100.0%
Taylor expanded in x around inf 80.7%
if -3.19999999999999983e67 < x < 7.80000000000000044e-63Initial program 100.0%
Taylor expanded in x around 0 80.0%
neg-mul-180.0%
distribute-neg-frac280.0%
neg-sub080.0%
associate--r-80.0%
metadata-eval80.0%
Simplified80.0%
Final simplification80.4%
(FPCore (x y) :precision binary64 (if (<= y -5e-14) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -5e-14) {
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 <= (-5d-14)) 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 <= -5e-14) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5e-14: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5e-14) 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 <= -5e-14) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5e-14], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-14}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.0000000000000002e-14 or 1 < y Initial program 100.0%
Taylor expanded in y around inf 70.1%
if -5.0000000000000002e-14 < y < 1Initial program 100.0%
Taylor expanded in y around 0 78.6%
Final simplification74.3%
(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 37.3%
Final simplification37.3%
herbie shell --seed 2024059
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))