
(FPCore (x y) :precision binary64 (/ (+ x y) (- x y)))
double code(double x, double y) {
return (x + y) / (x - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (x - y)
end function
public static double code(double x, double y) {
return (x + y) / (x - y);
}
def code(x, y): return (x + y) / (x - y)
function code(x, y) return Float64(Float64(x + y) / Float64(x - y)) end
function tmp = code(x, y) tmp = (x + y) / (x - y); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{x - y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (+ x y) (- x y)))
double code(double x, double y) {
return (x + y) / (x - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (x - y)
end function
public static double code(double x, double y) {
return (x + y) / (x - y);
}
def code(x, y): return (x + y) / (x - y)
function code(x, y) return Float64(Float64(x + y) / Float64(x - y)) end
function tmp = code(x, y) tmp = (x + y) / (x - y); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{x - y}
\end{array}
(FPCore (x y) :precision binary64 (/ 1.0 (/ (- x y) (+ x y))))
double code(double x, double y) {
return 1.0 / ((x - y) / (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / ((x - y) / (x + y))
end function
public static double code(double x, double y) {
return 1.0 / ((x - y) / (x + y));
}
def code(x, y): return 1.0 / ((x - y) / (x + y))
function code(x, y) return Float64(1.0 / Float64(Float64(x - y) / Float64(x + y))) end
function tmp = code(x, y) tmp = 1.0 / ((x - y) / (x + y)); end
code[x_, y_] := N[(1.0 / N[(N[(x - y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{x - y}{x + y}}
\end{array}
Initial program 100.0%
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-lowering-+.f64100.0%
Applied egg-rr100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ -1.0 (* -2.0 (/ x y))))) (if (<= y -4.8e+21) t_0 (if (<= y 4.6e+18) (+ 1.0 (/ (* y 2.0) x)) t_0))))
double code(double x, double y) {
double t_0 = -1.0 + (-2.0 * (x / y));
double tmp;
if (y <= -4.8e+21) {
tmp = t_0;
} else if (y <= 4.6e+18) {
tmp = 1.0 + ((y * 2.0) / x);
} 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) + ((-2.0d0) * (x / y))
if (y <= (-4.8d+21)) then
tmp = t_0
else if (y <= 4.6d+18) then
tmp = 1.0d0 + ((y * 2.0d0) / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = -1.0 + (-2.0 * (x / y));
double tmp;
if (y <= -4.8e+21) {
tmp = t_0;
} else if (y <= 4.6e+18) {
tmp = 1.0 + ((y * 2.0) / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -1.0 + (-2.0 * (x / y)) tmp = 0 if y <= -4.8e+21: tmp = t_0 elif y <= 4.6e+18: tmp = 1.0 + ((y * 2.0) / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(-1.0 + Float64(-2.0 * Float64(x / y))) tmp = 0.0 if (y <= -4.8e+21) tmp = t_0; elseif (y <= 4.6e+18) tmp = Float64(1.0 + Float64(Float64(y * 2.0) / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = -1.0 + (-2.0 * (x / y)); tmp = 0.0; if (y <= -4.8e+21) tmp = t_0; elseif (y <= 4.6e+18) tmp = 1.0 + ((y * 2.0) / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 + N[(-2.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e+21], t$95$0, If[LessEqual[y, 4.6e+18], N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + -2 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+18}:\\
\;\;\;\;1 + \frac{y \cdot 2}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.8e21 or 4.6e18 < y Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
*-commutativeN/A
metadata-evalN/A
associate-*l/N/A
metadata-evalN/A
distribute-rgt-out--N/A
*-lft-identityN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lft-identityN/A
distribute-rgt-out--N/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6485.0%
Simplified85.0%
if -4.8e21 < y < 4.6e18Initial program 100.0%
Taylor expanded in x around inf
associate--l+N/A
*-lft-identityN/A
distribute-rgt-out--N/A
*-rgt-identityN/A
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
distribute-rgt-out--N/A
*-lft-identityN/A
/-lowering-/.f64N/A
*-lft-identityN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-lowering-*.f6476.6%
Simplified76.6%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ -1.0 (* -2.0 (/ x y))))) (if (<= y -2.8e+23) t_0 (if (<= y 3.9e+18) (+ 1.0 (/ y x)) t_0))))
double code(double x, double y) {
double t_0 = -1.0 + (-2.0 * (x / y));
double tmp;
if (y <= -2.8e+23) {
tmp = t_0;
} else if (y <= 3.9e+18) {
tmp = 1.0 + (y / x);
} 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) + ((-2.0d0) * (x / y))
if (y <= (-2.8d+23)) then
tmp = t_0
else if (y <= 3.9d+18) then
tmp = 1.0d0 + (y / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = -1.0 + (-2.0 * (x / y));
double tmp;
if (y <= -2.8e+23) {
tmp = t_0;
} else if (y <= 3.9e+18) {
tmp = 1.0 + (y / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -1.0 + (-2.0 * (x / y)) tmp = 0 if y <= -2.8e+23: tmp = t_0 elif y <= 3.9e+18: tmp = 1.0 + (y / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(-1.0 + Float64(-2.0 * Float64(x / y))) tmp = 0.0 if (y <= -2.8e+23) tmp = t_0; elseif (y <= 3.9e+18) tmp = Float64(1.0 + Float64(y / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = -1.0 + (-2.0 * (x / y)); tmp = 0.0; if (y <= -2.8e+23) tmp = t_0; elseif (y <= 3.9e+18) tmp = 1.0 + (y / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 + N[(-2.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.8e+23], t$95$0, If[LessEqual[y, 3.9e+18], N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + -2 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+18}:\\
\;\;\;\;1 + \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.8e23 or 3.9e18 < y Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
*-commutativeN/A
metadata-evalN/A
associate-*l/N/A
metadata-evalN/A
distribute-rgt-out--N/A
*-lft-identityN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lft-identityN/A
distribute-rgt-out--N/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6485.0%
Simplified85.0%
if -2.8e23 < y < 3.9e18Initial program 100.0%
Taylor expanded in x around inf
Simplified76.2%
clear-numN/A
associate-/r/N/A
+-commutativeN/A
distribute-rgt-inN/A
div-invN/A
div-invN/A
*-inversesN/A
+-lowering-+.f64N/A
/-lowering-/.f6476.2%
Applied egg-rr76.2%
Final simplification79.9%
(FPCore (x y) :precision binary64 (if (<= y -2.8e+20) (- -1.0 (/ x y)) (if (<= y 2.7e+16) (+ 1.0 (/ y x)) (/ y (- x y)))))
double code(double x, double y) {
double tmp;
if (y <= -2.8e+20) {
tmp = -1.0 - (x / y);
} else if (y <= 2.7e+16) {
tmp = 1.0 + (y / x);
} else {
tmp = y / (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 <= (-2.8d+20)) then
tmp = (-1.0d0) - (x / y)
else if (y <= 2.7d+16) then
tmp = 1.0d0 + (y / x)
else
tmp = y / (x - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.8e+20) {
tmp = -1.0 - (x / y);
} else if (y <= 2.7e+16) {
tmp = 1.0 + (y / x);
} else {
tmp = y / (x - y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.8e+20: tmp = -1.0 - (x / y) elif y <= 2.7e+16: tmp = 1.0 + (y / x) else: tmp = y / (x - y) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.8e+20) tmp = Float64(-1.0 - Float64(x / y)); elseif (y <= 2.7e+16) tmp = Float64(1.0 + Float64(y / x)); else tmp = Float64(y / Float64(x - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.8e+20) tmp = -1.0 - (x / y); elseif (y <= 2.7e+16) tmp = 1.0 + (y / x); else tmp = y / (x - y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.8e+20], N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+16], N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+20}:\\
\;\;\;\;-1 - \frac{x}{y}\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+16}:\\
\;\;\;\;1 + \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x - y}\\
\end{array}
\end{array}
if y < -2.8e20Initial program 99.9%
Taylor expanded in x around 0
Simplified84.8%
Taylor expanded in y around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6485.2%
Simplified85.2%
if -2.8e20 < y < 2.7e16Initial program 100.0%
Taylor expanded in x around inf
Simplified76.5%
clear-numN/A
associate-/r/N/A
+-commutativeN/A
distribute-rgt-inN/A
div-invN/A
div-invN/A
*-inversesN/A
+-lowering-+.f64N/A
/-lowering-/.f6476.5%
Applied egg-rr76.5%
if 2.7e16 < y Initial program 99.9%
Taylor expanded in x around 0
Simplified82.2%
Final simplification79.5%
(FPCore (x y) :precision binary64 (let* ((t_0 (- -1.0 (/ x y)))) (if (<= y -3e+23) t_0 (if (<= y 3.9e+18) (+ 1.0 (/ y x)) t_0))))
double code(double x, double y) {
double t_0 = -1.0 - (x / y);
double tmp;
if (y <= -3e+23) {
tmp = t_0;
} else if (y <= 3.9e+18) {
tmp = 1.0 + (y / x);
} 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 <= (-3d+23)) then
tmp = t_0
else if (y <= 3.9d+18) then
tmp = 1.0d0 + (y / x)
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 <= -3e+23) {
tmp = t_0;
} else if (y <= 3.9e+18) {
tmp = 1.0 + (y / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -1.0 - (x / y) tmp = 0 if y <= -3e+23: tmp = t_0 elif y <= 3.9e+18: tmp = 1.0 + (y / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(-1.0 - Float64(x / y)) tmp = 0.0 if (y <= -3e+23) tmp = t_0; elseif (y <= 3.9e+18) tmp = Float64(1.0 + Float64(y / x)); 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 <= -3e+23) tmp = t_0; elseif (y <= 3.9e+18) tmp = 1.0 + (y / x); 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, -3e+23], t$95$0, If[LessEqual[y, 3.9e+18], N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -3 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+18}:\\
\;\;\;\;1 + \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.0000000000000001e23 or 3.9e18 < y Initial program 99.9%
Taylor expanded in x around 0
Simplified84.0%
Taylor expanded in y around inf
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
/-lowering-/.f6484.2%
Simplified84.2%
if -3.0000000000000001e23 < y < 3.9e18Initial program 100.0%
Taylor expanded in x around inf
Simplified76.2%
clear-numN/A
associate-/r/N/A
+-commutativeN/A
distribute-rgt-inN/A
div-invN/A
div-invN/A
*-inversesN/A
+-lowering-+.f64N/A
/-lowering-/.f6476.2%
Applied egg-rr76.2%
Final simplification79.5%
(FPCore (x y) :precision binary64 (if (<= y -1.16e+23) -1.0 (if (<= y 1.1e+20) (+ 1.0 (/ y x)) -1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.16e+23) {
tmp = -1.0;
} else if (y <= 1.1e+20) {
tmp = 1.0 + (y / 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.16d+23)) then
tmp = -1.0d0
else if (y <= 1.1d+20) then
tmp = 1.0d0 + (y / x)
else
tmp = -1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.16e+23) {
tmp = -1.0;
} else if (y <= 1.1e+20) {
tmp = 1.0 + (y / x);
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.16e+23: tmp = -1.0 elif y <= 1.1e+20: tmp = 1.0 + (y / x) else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.16e+23) tmp = -1.0; elseif (y <= 1.1e+20) tmp = Float64(1.0 + Float64(y / x)); else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.16e+23) tmp = -1.0; elseif (y <= 1.1e+20) tmp = 1.0 + (y / x); else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.16e+23], -1.0, If[LessEqual[y, 1.1e+20], N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{+23}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+20}:\\
\;\;\;\;1 + \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < -1.16e23 or 1.1e20 < y Initial program 99.9%
Taylor expanded in x around 0
Simplified83.6%
if -1.16e23 < y < 1.1e20Initial program 100.0%
Taylor expanded in x around inf
Simplified76.2%
clear-numN/A
associate-/r/N/A
+-commutativeN/A
distribute-rgt-inN/A
div-invN/A
div-invN/A
*-inversesN/A
+-lowering-+.f64N/A
/-lowering-/.f6476.2%
Applied egg-rr76.2%
Final simplification79.3%
(FPCore (x y) :precision binary64 (if (<= y -1.95e+23) -1.0 (if (<= y 1.95e+17) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.95e+23) {
tmp = -1.0;
} else if (y <= 1.95e+17) {
tmp = 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.95d+23)) then
tmp = -1.0d0
else if (y <= 1.95d+17) then
tmp = 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.95e+23) {
tmp = -1.0;
} else if (y <= 1.95e+17) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.95e+23: tmp = -1.0 elif y <= 1.95e+17: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.95e+23) tmp = -1.0; elseif (y <= 1.95e+17) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.95e+23) tmp = -1.0; elseif (y <= 1.95e+17) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.95e+23], -1.0, If[LessEqual[y, 1.95e+17], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+23}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+17}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < -1.95e23 or 1.95e17 < y Initial program 99.9%
Taylor expanded in x around 0
Simplified83.0%
if -1.95e23 < y < 1.95e17Initial program 100.0%
Taylor expanded in x around inf
Simplified75.8%
(FPCore (x y) :precision binary64 (/ (+ x y) (- x y)))
double code(double x, double y) {
return (x + y) / (x - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x + y) / (x - y)
end function
public static double code(double x, double y) {
return (x + y) / (x - y);
}
def code(x, y): return (x + y) / (x - y)
function code(x, y) return Float64(Float64(x + y) / Float64(x - y)) end
function tmp = code(x, y) tmp = (x + y) / (x - y); end
code[x_, y_] := N[(N[(x + y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{x - y}
\end{array}
Initial program 100.0%
(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 x around 0
Simplified48.5%
(FPCore (x y) :precision binary64 (/ 1.0 (- (/ x (+ x y)) (/ y (+ x y)))))
double code(double x, double y) {
return 1.0 / ((x / (x + y)) - (y / (x + y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / ((x / (x + y)) - (y / (x + y)))
end function
public static double code(double x, double y) {
return 1.0 / ((x / (x + y)) - (y / (x + y)));
}
def code(x, y): return 1.0 / ((x / (x + y)) - (y / (x + y)))
function code(x, y) return Float64(1.0 / Float64(Float64(x / Float64(x + y)) - Float64(y / Float64(x + y)))) end
function tmp = code(x, y) tmp = 1.0 / ((x / (x + y)) - (y / (x + y))); end
code[x_, y_] := N[(1.0 / N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{x}{x + y} - \frac{y}{x + y}}
\end{array}
herbie shell --seed 2024155
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ 1 (- (/ x (+ x y)) (/ y (+ x y)))))
(/ (+ x y) (- x y)))