
(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%
(FPCore (x y)
:precision binary64
(if (<= x -8.2e+130)
-1.0
(if (<= x 1.02e-100)
1.0
(if (<= x 4.8e-31) (/ x 2.0) (if (<= x 4.6e+38) 1.0 -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -8.2e+130) {
tmp = -1.0;
} else if (x <= 1.02e-100) {
tmp = 1.0;
} else if (x <= 4.8e-31) {
tmp = x / 2.0;
} else if (x <= 4.6e+38) {
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 <= (-8.2d+130)) then
tmp = -1.0d0
else if (x <= 1.02d-100) then
tmp = 1.0d0
else if (x <= 4.8d-31) then
tmp = x / 2.0d0
else if (x <= 4.6d+38) 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 <= -8.2e+130) {
tmp = -1.0;
} else if (x <= 1.02e-100) {
tmp = 1.0;
} else if (x <= 4.8e-31) {
tmp = x / 2.0;
} else if (x <= 4.6e+38) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -8.2e+130: tmp = -1.0 elif x <= 1.02e-100: tmp = 1.0 elif x <= 4.8e-31: tmp = x / 2.0 elif x <= 4.6e+38: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -8.2e+130) tmp = -1.0; elseif (x <= 1.02e-100) tmp = 1.0; elseif (x <= 4.8e-31) tmp = Float64(x / 2.0); elseif (x <= 4.6e+38) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -8.2e+130) tmp = -1.0; elseif (x <= 1.02e-100) tmp = 1.0; elseif (x <= 4.8e-31) tmp = x / 2.0; elseif (x <= 4.6e+38) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -8.2e+130], -1.0, If[LessEqual[x, 1.02e-100], 1.0, If[LessEqual[x, 4.8e-31], N[(x / 2.0), $MachinePrecision], If[LessEqual[x, 4.6e+38], 1.0, -1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+130}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-100}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{x}{2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+38}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -8.19999999999999955e130 or 4.6000000000000002e38 < x Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 84.9%
if -8.19999999999999955e130 < x < 1.02e-100 or 4.8e-31 < x < 4.6000000000000002e38Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 53.9%
if 1.02e-100 < x < 4.8e-31Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 73.0%
mul-1-neg73.0%
distribute-neg-frac273.0%
neg-sub073.0%
associate-+l-73.0%
neg-sub073.0%
+-commutative73.0%
unsub-neg73.0%
Simplified73.0%
Taylor expanded in x around 0 73.0%
(FPCore (x y) :precision binary64 (if (<= x -1.1e+90) (/ (- y x) x) (if (<= x 5e-7) (/ (- y x) (- y 2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.1e+90) {
tmp = (y - x) / x;
} else if (x <= 5e-7) {
tmp = (y - x) / (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 <= (-1.1d+90)) then
tmp = (y - x) / x
else if (x <= 5d-7) then
tmp = (y - x) / (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 <= -1.1e+90) {
tmp = (y - x) / x;
} else if (x <= 5e-7) {
tmp = (y - x) / (y - 2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.1e+90: tmp = (y - x) / x elif x <= 5e-7: tmp = (y - x) / (y - 2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.1e+90) tmp = Float64(Float64(y - x) / x); elseif (x <= 5e-7) tmp = Float64(Float64(y - x) / 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 <= -1.1e+90) tmp = (y - x) / x; elseif (x <= 5e-7) tmp = (y - x) / (y - 2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.1e+90], N[(N[(y - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 5e-7], N[(N[(y - x), $MachinePrecision] / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+90}:\\
\;\;\;\;\frac{y - x}{x}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\frac{y - x}{y - 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -1.09999999999999995e90Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 87.4%
if -1.09999999999999995e90 < x < 4.99999999999999977e-7Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 95.9%
if 4.99999999999999977e-7 < x Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 77.8%
mul-1-neg77.8%
distribute-neg-frac277.8%
neg-sub077.8%
associate-+l-77.8%
neg-sub077.8%
+-commutative77.8%
unsub-neg77.8%
Simplified77.8%
(FPCore (x y) :precision binary64 (if (<= x -7.5e+89) (/ (- y x) x) (if (<= x 5.1e-101) (/ y (- y 2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -7.5e+89) {
tmp = (y - x) / x;
} else if (x <= 5.1e-101) {
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 <= (-7.5d+89)) then
tmp = (y - x) / x
else if (x <= 5.1d-101) 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 <= -7.5e+89) {
tmp = (y - x) / x;
} else if (x <= 5.1e-101) {
tmp = y / (y - 2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.5e+89: tmp = (y - x) / x elif x <= 5.1e-101: tmp = y / (y - 2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -7.5e+89) tmp = Float64(Float64(y - x) / x); elseif (x <= 5.1e-101) 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 <= -7.5e+89) tmp = (y - x) / x; elseif (x <= 5.1e-101) tmp = y / (y - 2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.5e+89], N[(N[(y - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 5.1e-101], 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 -7.5 \cdot 10^{+89}:\\
\;\;\;\;\frac{y - x}{x}\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{-101}:\\
\;\;\;\;\frac{y}{y - 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -7.49999999999999947e89Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 87.4%
if -7.49999999999999947e89 < x < 5.1000000000000002e-101Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 76.9%
if 5.1000000000000002e-101 < x Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 73.9%
mul-1-neg73.9%
distribute-neg-frac273.9%
neg-sub073.9%
associate-+l-73.9%
neg-sub073.9%
+-commutative73.9%
unsub-neg73.9%
Simplified73.9%
(FPCore (x y) :precision binary64 (if (<= x -8.2e+130) -1.0 (if (<= x 1.1e-100) (/ y (- y 2.0)) (/ x (- 2.0 x)))))
double code(double x, double y) {
double tmp;
if (x <= -8.2e+130) {
tmp = -1.0;
} else if (x <= 1.1e-100) {
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 <= (-8.2d+130)) then
tmp = -1.0d0
else if (x <= 1.1d-100) 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 <= -8.2e+130) {
tmp = -1.0;
} else if (x <= 1.1e-100) {
tmp = y / (y - 2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -8.2e+130: tmp = -1.0 elif x <= 1.1e-100: tmp = y / (y - 2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if (x <= -8.2e+130) tmp = -1.0; elseif (x <= 1.1e-100) 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 <= -8.2e+130) tmp = -1.0; elseif (x <= 1.1e-100) tmp = y / (y - 2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -8.2e+130], -1.0, If[LessEqual[x, 1.1e-100], 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 -8.2 \cdot 10^{+130}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-100}:\\
\;\;\;\;\frac{y}{y - 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if x < -8.19999999999999955e130Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 88.8%
if -8.19999999999999955e130 < x < 1.09999999999999995e-100Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 76.4%
if 1.09999999999999995e-100 < x Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 73.9%
mul-1-neg73.9%
distribute-neg-frac273.9%
neg-sub073.9%
associate-+l-73.9%
neg-sub073.9%
+-commutative73.9%
unsub-neg73.9%
Simplified73.9%
(FPCore (x y) :precision binary64 (if (<= y -5200000000.0) 1.0 (if (<= y 6.5e+72) (/ x (- 2.0 x)) 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -5200000000.0) {
tmp = 1.0;
} else if (y <= 6.5e+72) {
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 <= (-5200000000.0d0)) then
tmp = 1.0d0
else if (y <= 6.5d+72) 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 <= -5200000000.0) {
tmp = 1.0;
} else if (y <= 6.5e+72) {
tmp = x / (2.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5200000000.0: tmp = 1.0 elif y <= 6.5e+72: tmp = x / (2.0 - x) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5200000000.0) tmp = 1.0; elseif (y <= 6.5e+72) 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 <= -5200000000.0) tmp = 1.0; elseif (y <= 6.5e+72) tmp = x / (2.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5200000000.0], 1.0, If[LessEqual[y, 6.5e+72], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5200000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+72}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.2e9 or 6.5000000000000001e72 < y Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 74.5%
if -5.2e9 < y < 6.5000000000000001e72Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 76.7%
mul-1-neg76.7%
distribute-neg-frac276.7%
neg-sub076.7%
associate-+l-76.7%
neg-sub076.7%
+-commutative76.7%
unsub-neg76.7%
Simplified76.7%
(FPCore (x y) :precision binary64 (if (<= x -8.2e+130) -1.0 (if (<= x 4e+38) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -8.2e+130) {
tmp = -1.0;
} else if (x <= 4e+38) {
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 <= (-8.2d+130)) then
tmp = -1.0d0
else if (x <= 4d+38) 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 <= -8.2e+130) {
tmp = -1.0;
} else if (x <= 4e+38) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -8.2e+130: tmp = -1.0 elif x <= 4e+38: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -8.2e+130) tmp = -1.0; elseif (x <= 4e+38) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -8.2e+130) tmp = -1.0; elseif (x <= 4e+38) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -8.2e+130], -1.0, If[LessEqual[x, 4e+38], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+130}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+38}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -8.19999999999999955e130 or 3.99999999999999991e38 < x Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 84.9%
if -8.19999999999999955e130 < x < 3.99999999999999991e38Initial program 100.0%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 49.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%
remove-double-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
associate-+r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 38.9%
(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 2024146
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:alt
(! :herbie-platform default (- (/ x (- 2 (+ x y))) (/ y (- 2 (+ x y)))))
(/ (- x y) (- 2.0 (+ x y))))