
(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 -1.15e+28)
-1.0
(if (<= x 7.2e-222)
1.0
(if (<= x 1.7e-182)
(* y -0.5)
(if (<= x 4.8e-154)
1.0
(if (<= x 1.1e-7) (* x 0.5) (if (<= x 530000000000.0) 1.0 -1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -1.15e+28) {
tmp = -1.0;
} else if (x <= 7.2e-222) {
tmp = 1.0;
} else if (x <= 1.7e-182) {
tmp = y * -0.5;
} else if (x <= 4.8e-154) {
tmp = 1.0;
} else if (x <= 1.1e-7) {
tmp = x * 0.5;
} else if (x <= 530000000000.0) {
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 (x <= (-1.15d+28)) then
tmp = -1.0d0
else if (x <= 7.2d-222) then
tmp = 1.0d0
else if (x <= 1.7d-182) then
tmp = y * (-0.5d0)
else if (x <= 4.8d-154) then
tmp = 1.0d0
else if (x <= 1.1d-7) then
tmp = x * 0.5d0
else if (x <= 530000000000.0d0) 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 (x <= -1.15e+28) {
tmp = -1.0;
} else if (x <= 7.2e-222) {
tmp = 1.0;
} else if (x <= 1.7e-182) {
tmp = y * -0.5;
} else if (x <= 4.8e-154) {
tmp = 1.0;
} else if (x <= 1.1e-7) {
tmp = x * 0.5;
} else if (x <= 530000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.15e+28: tmp = -1.0 elif x <= 7.2e-222: tmp = 1.0 elif x <= 1.7e-182: tmp = y * -0.5 elif x <= 4.8e-154: tmp = 1.0 elif x <= 1.1e-7: tmp = x * 0.5 elif x <= 530000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.15e+28) tmp = -1.0; elseif (x <= 7.2e-222) tmp = 1.0; elseif (x <= 1.7e-182) tmp = Float64(y * -0.5); elseif (x <= 4.8e-154) tmp = 1.0; elseif (x <= 1.1e-7) tmp = Float64(x * 0.5); elseif (x <= 530000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.15e+28) tmp = -1.0; elseif (x <= 7.2e-222) tmp = 1.0; elseif (x <= 1.7e-182) tmp = y * -0.5; elseif (x <= 4.8e-154) tmp = 1.0; elseif (x <= 1.1e-7) tmp = x * 0.5; elseif (x <= 530000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.15e+28], -1.0, If[LessEqual[x, 7.2e-222], 1.0, If[LessEqual[x, 1.7e-182], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 4.8e-154], 1.0, If[LessEqual[x, 1.1e-7], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 530000000000.0], 1.0, -1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+28}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-222}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-182}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-154}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-7}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 530000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -1.14999999999999992e28 or 5.3e11 < x Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
if -1.14999999999999992e28 < x < 7.19999999999999948e-222 or 1.69999999999999995e-182 < x < 4.79999999999999974e-154 or 1.1000000000000001e-7 < x < 5.3e11Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 59.7%
if 7.19999999999999948e-222 < x < 1.69999999999999995e-182Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 77.0%
associate-*r/77.0%
neg-mul-177.0%
Simplified77.0%
Taylor expanded in y around 0 77.0%
*-commutative77.0%
Simplified77.0%
if 4.79999999999999974e-154 < x < 1.1000000000000001e-7Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 48.6%
Taylor expanded in x around 0 47.2%
*-commutative47.2%
Simplified47.2%
Final simplification69.6%
(FPCore (x y)
:precision binary64
(if (<= x -3.7e+27)
-1.0
(if (<= x 3.4e-153)
1.0
(if (<= x 1.1e-7) (* x 0.5) (if (<= x 820000000000.0) 1.0 -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -3.7e+27) {
tmp = -1.0;
} else if (x <= 3.4e-153) {
tmp = 1.0;
} else if (x <= 1.1e-7) {
tmp = x * 0.5;
} else if (x <= 820000000000.0) {
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 (x <= (-3.7d+27)) then
tmp = -1.0d0
else if (x <= 3.4d-153) then
tmp = 1.0d0
else if (x <= 1.1d-7) then
tmp = x * 0.5d0
else if (x <= 820000000000.0d0) 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 (x <= -3.7e+27) {
tmp = -1.0;
} else if (x <= 3.4e-153) {
tmp = 1.0;
} else if (x <= 1.1e-7) {
tmp = x * 0.5;
} else if (x <= 820000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.7e+27: tmp = -1.0 elif x <= 3.4e-153: tmp = 1.0 elif x <= 1.1e-7: tmp = x * 0.5 elif x <= 820000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -3.7e+27) tmp = -1.0; elseif (x <= 3.4e-153) tmp = 1.0; elseif (x <= 1.1e-7) tmp = Float64(x * 0.5); elseif (x <= 820000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.7e+27) tmp = -1.0; elseif (x <= 3.4e-153) tmp = 1.0; elseif (x <= 1.1e-7) tmp = x * 0.5; elseif (x <= 820000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.7e+27], -1.0, If[LessEqual[x, 3.4e-153], 1.0, If[LessEqual[x, 1.1e-7], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 820000000000.0], 1.0, -1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+27}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-153}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-7}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 820000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -3.70000000000000002e27 or 8.2e11 < x Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
if -3.70000000000000002e27 < x < 3.3999999999999998e-153 or 1.1000000000000001e-7 < x < 8.2e11Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 56.6%
if 3.3999999999999998e-153 < x < 1.1000000000000001e-7Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 48.6%
Taylor expanded in x around 0 47.2%
*-commutative47.2%
Simplified47.2%
Final simplification67.9%
(FPCore (x y) :precision binary64 (if (or (<= x -3.7e-17) (not (<= x 6.5e-98))) (/ x (- 2.0 x)) (/ y (+ y -2.0))))
double code(double x, double y) {
double tmp;
if ((x <= -3.7e-17) || !(x <= 6.5e-98)) {
tmp = x / (2.0 - x);
} else {
tmp = y / (y + -2.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.7d-17)) .or. (.not. (x <= 6.5d-98))) then
tmp = x / (2.0d0 - x)
else
tmp = y / (y + (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -3.7e-17) || !(x <= 6.5e-98)) {
tmp = x / (2.0 - x);
} else {
tmp = y / (y + -2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3.7e-17) or not (x <= 6.5e-98): tmp = x / (2.0 - x) else: tmp = y / (y + -2.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -3.7e-17) || !(x <= 6.5e-98)) tmp = Float64(x / Float64(2.0 - x)); else tmp = Float64(y / Float64(y + -2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3.7e-17) || ~((x <= 6.5e-98))) tmp = x / (2.0 - x); else tmp = y / (y + -2.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3.7e-17], N[Not[LessEqual[x, 6.5e-98]], $MachinePrecision]], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-17} \lor \neg \left(x \leq 6.5 \cdot 10^{-98}\right):\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -2}\\
\end{array}
\end{array}
if x < -3.6999999999999997e-17 or 6.50000000000000017e-98 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around 0 77.8%
if -3.6999999999999997e-17 < x < 6.50000000000000017e-98Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 83.3%
associate-*r/83.3%
neg-mul-183.3%
Simplified83.3%
frac-2neg83.3%
div-inv83.2%
remove-double-neg83.2%
sub-neg83.2%
distribute-neg-in83.2%
metadata-eval83.2%
remove-double-neg83.2%
Applied egg-rr83.2%
associate-*r/83.3%
*-rgt-identity83.3%
+-commutative83.3%
Simplified83.3%
Final simplification80.0%
(FPCore (x y) :precision binary64 (if (<= y -6.8e+90) 1.0 (if (<= y 29000000.0) (/ x (- 2.0 x)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -6.8e+90) {
tmp = 1.0;
} else if (y <= 29000000.0) {
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 <= (-6.8d+90)) then
tmp = 1.0d0
else if (y <= 29000000.0d0) 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 <= -6.8e+90) {
tmp = 1.0;
} else if (y <= 29000000.0) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.8e+90: tmp = 1.0 elif y <= 29000000.0: tmp = x / (2.0 - x) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6.8e+90) tmp = 1.0; elseif (y <= 29000000.0) 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 <= -6.8e+90) tmp = 1.0; elseif (y <= 29000000.0) tmp = x / (2.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.8e+90], 1.0, If[LessEqual[y, 29000000.0], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+90}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 29000000:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6.80000000000000036e90 or 2.9e7 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 78.5%
if -6.80000000000000036e90 < y < 2.9e7Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 73.6%
Final simplification75.5%
(FPCore (x y) :precision binary64 (if (<= x -5.7e-18) (/ 1.0 (+ (/ 2.0 x) -1.0)) (if (<= x 1.02e-97) (/ y (+ y -2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -5.7e-18) {
tmp = 1.0 / ((2.0 / x) + -1.0);
} else if (x <= 1.02e-97) {
tmp = y / (y + -2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.7d-18)) then
tmp = 1.0d0 / ((2.0d0 / x) + (-1.0d0))
else if (x <= 1.02d-97) then
tmp = y / (y + (-2.0d0))
else
tmp = x / (2.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5.7e-18) {
tmp = 1.0 / ((2.0 / x) + -1.0);
} else if (x <= 1.02e-97) {
tmp = y / (y + -2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.7e-18: tmp = 1.0 / ((2.0 / x) + -1.0) elif x <= 1.02e-97: tmp = y / (y + -2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -5.7e-18) tmp = Float64(1.0 / Float64(Float64(2.0 / x) + -1.0)); elseif (x <= 1.02e-97) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(x / Float64(2.0 - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.7e-18) tmp = 1.0 / ((2.0 / x) + -1.0); elseif (x <= 1.02e-97) tmp = y / (y + -2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.7e-18], N[(1.0 / N[(N[(2.0 / x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.02e-97], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{\frac{2}{x} + -1}\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -5.69999999999999971e-18Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around 0 83.6%
clear-num83.6%
inv-pow83.6%
Applied egg-rr83.6%
unpow-183.6%
div-sub83.7%
sub-neg83.7%
*-inverses83.7%
metadata-eval83.7%
Simplified83.7%
if -5.69999999999999971e-18 < x < 1.02000000000000004e-97Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 83.3%
associate-*r/83.3%
neg-mul-183.3%
Simplified83.3%
frac-2neg83.3%
div-inv83.2%
remove-double-neg83.2%
sub-neg83.2%
distribute-neg-in83.2%
metadata-eval83.2%
remove-double-neg83.2%
Applied egg-rr83.2%
associate-*r/83.3%
*-rgt-identity83.3%
+-commutative83.3%
Simplified83.3%
if 1.02000000000000004e-97 < x Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 73.2%
Final simplification80.1%
(FPCore (x y) :precision binary64 (if (<= x -9.6e+27) -1.0 (if (<= x 112000000000.0) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -9.6e+27) {
tmp = -1.0;
} else if (x <= 112000000000.0) {
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 (x <= (-9.6d+27)) then
tmp = -1.0d0
else if (x <= 112000000000.0d0) 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 (x <= -9.6e+27) {
tmp = -1.0;
} else if (x <= 112000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9.6e+27: tmp = -1.0 elif x <= 112000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -9.6e+27) tmp = -1.0; elseif (x <= 112000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9.6e+27) tmp = -1.0; elseif (x <= 112000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9.6e+27], -1.0, If[LessEqual[x, 112000000000.0], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{+27}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 112000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -9.59999999999999991e27 or 1.12e11 < x Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
if -9.59999999999999991e27 < x < 1.12e11Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 51.3%
Final simplification66.2%
(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 41.1%
Final simplification41.1%
(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 2024034
(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))))