
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= x -0.00325) (/ x (- 2.0 x)) (if (<= x 1.05e+57) (/ (- x y) (- 2.0 y)) (+ (/ y x) -1.0))))
double code(double x, double y) {
double tmp;
if (x <= -0.00325) {
tmp = x / (2.0 - x);
} else if (x <= 1.05e+57) {
tmp = (x - y) / (2.0 - y);
} else {
tmp = (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 (x <= (-0.00325d0)) then
tmp = x / (2.0d0 - x)
else if (x <= 1.05d+57) then
tmp = (x - y) / (2.0d0 - y)
else
tmp = (y / x) + (-1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.00325) {
tmp = x / (2.0 - x);
} else if (x <= 1.05e+57) {
tmp = (x - y) / (2.0 - y);
} else {
tmp = (y / x) + -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.00325: tmp = x / (2.0 - x) elif x <= 1.05e+57: tmp = (x - y) / (2.0 - y) else: tmp = (y / x) + -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -0.00325) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 1.05e+57) tmp = Float64(Float64(x - y) / Float64(2.0 - y)); else tmp = Float64(Float64(y / x) + -1.0); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.00325) tmp = x / (2.0 - x); elseif (x <= 1.05e+57) tmp = (x - y) / (2.0 - y); else tmp = (y / x) + -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.00325], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.05e+57], N[(N[(x - y), $MachinePrecision] / N[(2.0 - y), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00325:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+57}:\\
\;\;\;\;\frac{x - y}{2 - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + -1\\
\end{array}
\end{array}
if x < -0.00324999999999999985Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around 0 74.8%
if -0.00324999999999999985 < x < 1.04999999999999995e57Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 94.2%
if 1.04999999999999995e57 < x Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 81.4%
neg-mul-181.4%
Simplified81.4%
Taylor expanded in x around 0 81.4%
Final simplification86.9%
(FPCore (x y)
:precision binary64
(if (<= y -3.3e+59)
1.0
(if (<= y 1.55e-249)
-1.0
(if (<= y 5.2e-219) (* x 0.5) (if (<= y 1.45e+59) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3.3e+59) {
tmp = 1.0;
} else if (y <= 1.55e-249) {
tmp = -1.0;
} else if (y <= 5.2e-219) {
tmp = x * 0.5;
} else if (y <= 1.45e+59) {
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 <= (-3.3d+59)) then
tmp = 1.0d0
else if (y <= 1.55d-249) then
tmp = -1.0d0
else if (y <= 5.2d-219) then
tmp = x * 0.5d0
else if (y <= 1.45d+59) 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 <= -3.3e+59) {
tmp = 1.0;
} else if (y <= 1.55e-249) {
tmp = -1.0;
} else if (y <= 5.2e-219) {
tmp = x * 0.5;
} else if (y <= 1.45e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.3e+59: tmp = 1.0 elif y <= 1.55e-249: tmp = -1.0 elif y <= 5.2e-219: tmp = x * 0.5 elif y <= 1.45e+59: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.3e+59) tmp = 1.0; elseif (y <= 1.55e-249) tmp = -1.0; elseif (y <= 5.2e-219) tmp = Float64(x * 0.5); elseif (y <= 1.45e+59) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.3e+59) tmp = 1.0; elseif (y <= 1.55e-249) tmp = -1.0; elseif (y <= 5.2e-219) tmp = x * 0.5; elseif (y <= 1.45e+59) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.3e+59], 1.0, If[LessEqual[y, 1.55e-249], -1.0, If[LessEqual[y, 5.2e-219], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 1.45e+59], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+59}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-249}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-219}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.2999999999999999e59 or 1.44999999999999995e59 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 87.3%
if -3.2999999999999999e59 < y < 1.54999999999999993e-249 or 5.20000000000000004e-219 < y < 1.44999999999999995e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 55.5%
if 1.54999999999999993e-249 < y < 5.20000000000000004e-219Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification69.1%
(FPCore (x y)
:precision binary64
(if (<= y -5.5e+59)
1.0
(if (<= y 4.1e-250)
(+ -1.0 (/ -2.0 x))
(if (<= y 5.4e-219) (* x 0.5) (if (<= y 7.5e+56) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -5.5e+59) {
tmp = 1.0;
} else if (y <= 4.1e-250) {
tmp = -1.0 + (-2.0 / x);
} else if (y <= 5.4e-219) {
tmp = x * 0.5;
} else if (y <= 7.5e+56) {
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 <= (-5.5d+59)) then
tmp = 1.0d0
else if (y <= 4.1d-250) then
tmp = (-1.0d0) + ((-2.0d0) / x)
else if (y <= 5.4d-219) then
tmp = x * 0.5d0
else if (y <= 7.5d+56) 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 <= -5.5e+59) {
tmp = 1.0;
} else if (y <= 4.1e-250) {
tmp = -1.0 + (-2.0 / x);
} else if (y <= 5.4e-219) {
tmp = x * 0.5;
} else if (y <= 7.5e+56) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.5e+59: tmp = 1.0 elif y <= 4.1e-250: tmp = -1.0 + (-2.0 / x) elif y <= 5.4e-219: tmp = x * 0.5 elif y <= 7.5e+56: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.5e+59) tmp = 1.0; elseif (y <= 4.1e-250) tmp = Float64(-1.0 + Float64(-2.0 / x)); elseif (y <= 5.4e-219) tmp = Float64(x * 0.5); elseif (y <= 7.5e+56) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.5e+59) tmp = 1.0; elseif (y <= 4.1e-250) tmp = -1.0 + (-2.0 / x); elseif (y <= 5.4e-219) tmp = x * 0.5; elseif (y <= 7.5e+56) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.5e+59], 1.0, If[LessEqual[y, 4.1e-250], N[(-1.0 + N[(-2.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e-219], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 7.5e+56], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+59}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-250}:\\
\;\;\;\;-1 + \frac{-2}{x}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-219}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+56}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.4999999999999999e59 or 7.4999999999999999e56 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 87.3%
if -5.4999999999999999e59 < y < 4.10000000000000016e-250Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 77.7%
Taylor expanded in x around inf 58.9%
distribute-neg-in58.9%
metadata-eval58.9%
associate-*r/58.9%
metadata-eval58.9%
distribute-neg-frac58.9%
metadata-eval58.9%
Simplified58.9%
if 4.10000000000000016e-250 < y < 5.3999999999999999e-219Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 5.3999999999999999e-219 < y < 7.4999999999999999e56Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 51.4%
Final simplification69.1%
(FPCore (x y)
:precision binary64
(if (<= y -4.6e+59)
1.0
(if (<= y 1.85e-249)
(+ (/ y x) -1.0)
(if (<= y 5.4e-219) (* x 0.5) (if (<= y 1.04e+58) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -4.6e+59) {
tmp = 1.0;
} else if (y <= 1.85e-249) {
tmp = (y / x) + -1.0;
} else if (y <= 5.4e-219) {
tmp = x * 0.5;
} else if (y <= 1.04e+58) {
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 <= (-4.6d+59)) then
tmp = 1.0d0
else if (y <= 1.85d-249) then
tmp = (y / x) + (-1.0d0)
else if (y <= 5.4d-219) then
tmp = x * 0.5d0
else if (y <= 1.04d+58) 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 <= -4.6e+59) {
tmp = 1.0;
} else if (y <= 1.85e-249) {
tmp = (y / x) + -1.0;
} else if (y <= 5.4e-219) {
tmp = x * 0.5;
} else if (y <= 1.04e+58) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.6e+59: tmp = 1.0 elif y <= 1.85e-249: tmp = (y / x) + -1.0 elif y <= 5.4e-219: tmp = x * 0.5 elif y <= 1.04e+58: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.6e+59) tmp = 1.0; elseif (y <= 1.85e-249) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= 5.4e-219) tmp = Float64(x * 0.5); elseif (y <= 1.04e+58) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.6e+59) tmp = 1.0; elseif (y <= 1.85e-249) tmp = (y / x) + -1.0; elseif (y <= 5.4e-219) tmp = x * 0.5; elseif (y <= 1.04e+58) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.6e+59], 1.0, If[LessEqual[y, 1.85e-249], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, 5.4e-219], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 1.04e+58], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+59}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-249}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-219}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 1.04 \cdot 10^{+58}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.60000000000000016e59 or 1.04e58 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 87.3%
if -4.60000000000000016e59 < y < 1.84999999999999988e-249Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 59.1%
neg-mul-159.1%
Simplified59.1%
Taylor expanded in x around 0 59.1%
if 1.84999999999999988e-249 < y < 5.3999999999999999e-219Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 5.3999999999999999e-219 < y < 1.04e58Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 51.4%
Final simplification69.1%
(FPCore (x y) :precision binary64 (if (<= y -1.42e+60) 1.0 (if (<= y 8.2e+78) (/ x (- 2.0 x)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -1.42e+60) {
tmp = 1.0;
} else if (y <= 8.2e+78) {
tmp = x / (2.0 - 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.42d+60)) then
tmp = 1.0d0
else if (y <= 8.2d+78) then
tmp = x / (2.0d0 - x)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.42e+60) {
tmp = 1.0;
} else if (y <= 8.2e+78) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.42e+60: tmp = 1.0 elif y <= 8.2e+78: tmp = x / (2.0 - x) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.42e+60) tmp = 1.0; elseif (y <= 8.2e+78) tmp = Float64(x / Float64(2.0 - x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.42e+60) tmp = 1.0; elseif (y <= 8.2e+78) tmp = x / (2.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.42e+60], 1.0, If[LessEqual[y, 8.2e+78], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+60}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+78}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.42000000000000001e60 or 8.1999999999999994e78 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 88.1%
if -1.42000000000000001e60 < y < 8.1999999999999994e78Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 72.7%
Final simplification78.6%
(FPCore (x y) :precision binary64 (if (<= y -3.9e+59) 1.0 (if (<= y 1.25e+68) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -3.9e+59) {
tmp = 1.0;
} else if (y <= 1.25e+68) {
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 <= (-3.9d+59)) then
tmp = 1.0d0
else if (y <= 1.25d+68) 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 <= -3.9e+59) {
tmp = 1.0;
} else if (y <= 1.25e+68) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.9e+59: tmp = 1.0 elif y <= 1.25e+68: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.9e+59) tmp = 1.0; elseif (y <= 1.25e+68) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.9e+59) tmp = 1.0; elseif (y <= 1.25e+68) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.9e+59], 1.0, If[LessEqual[y, 1.25e+68], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{+59}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+68}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.90000000000000021e59 or 1.2500000000000001e68 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 87.3%
if -3.90000000000000021e59 < y < 1.2500000000000001e68Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 53.5%
Final simplification66.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%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 38.0%
Final simplification38.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = 2.0d0 - (x + y)
code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
def code(x, y): t_0 = 2.0 - (x + y) return (x / t_0) - (y / t_0)
function code(x, y) t_0 = Float64(2.0 - Float64(x + y)) return Float64(Float64(x / t_0) - Float64(y / t_0)) end
function tmp = code(x, y) t_0 = 2.0 - (x + y); tmp = (x / t_0) - (y / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t_0} - \frac{y}{t_0}
\end{array}
\end{array}
herbie shell --seed 2023178
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:herbie-target
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))