
(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 12 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
(let* ((t_0 (/ y (+ x (+ y -2.0)))))
(if (<= y -1600.0)
t_0
(if (<= y -6.5e-45)
(/ (- -2.0 x) x)
(if (<= y -4.7e-137)
(/ (- y x) -2.0)
(if (<= y 5.2e-8) (/ x (- 2.0 x)) t_0))))))
double code(double x, double y) {
double t_0 = y / (x + (y + -2.0));
double tmp;
if (y <= -1600.0) {
tmp = t_0;
} else if (y <= -6.5e-45) {
tmp = (-2.0 - x) / x;
} else if (y <= -4.7e-137) {
tmp = (y - x) / -2.0;
} else if (y <= 5.2e-8) {
tmp = x / (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 = y / (x + (y + (-2.0d0)))
if (y <= (-1600.0d0)) then
tmp = t_0
else if (y <= (-6.5d-45)) then
tmp = ((-2.0d0) - x) / x
else if (y <= (-4.7d-137)) then
tmp = (y - x) / (-2.0d0)
else if (y <= 5.2d-8) then
tmp = x / (2.0d0 - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (x + (y + -2.0));
double tmp;
if (y <= -1600.0) {
tmp = t_0;
} else if (y <= -6.5e-45) {
tmp = (-2.0 - x) / x;
} else if (y <= -4.7e-137) {
tmp = (y - x) / -2.0;
} else if (y <= 5.2e-8) {
tmp = x / (2.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (x + (y + -2.0)) tmp = 0 if y <= -1600.0: tmp = t_0 elif y <= -6.5e-45: tmp = (-2.0 - x) / x elif y <= -4.7e-137: tmp = (y - x) / -2.0 elif y <= 5.2e-8: tmp = x / (2.0 - x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(x + Float64(y + -2.0))) tmp = 0.0 if (y <= -1600.0) tmp = t_0; elseif (y <= -6.5e-45) tmp = Float64(Float64(-2.0 - x) / x); elseif (y <= -4.7e-137) tmp = Float64(Float64(y - x) / -2.0); elseif (y <= 5.2e-8) tmp = Float64(x / Float64(2.0 - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x + (y + -2.0)); tmp = 0.0; if (y <= -1600.0) tmp = t_0; elseif (y <= -6.5e-45) tmp = (-2.0 - x) / x; elseif (y <= -4.7e-137) tmp = (y - x) / -2.0; elseif (y <= 5.2e-8) tmp = x / (2.0 - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + N[(y + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1600.0], t$95$0, If[LessEqual[y, -6.5e-45], N[(N[(-2.0 - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, -4.7e-137], N[(N[(y - x), $MachinePrecision] / -2.0), $MachinePrecision], If[LessEqual[y, 5.2e-8], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + \left(y + -2\right)}\\
\mathbf{if}\;y \leq -1600:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{-45}:\\
\;\;\;\;\frac{-2 - x}{x}\\
\mathbf{elif}\;y \leq -4.7 \cdot 10^{-137}:\\
\;\;\;\;\frac{y - x}{-2}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1600 or 5.2000000000000002e-8 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 84.6%
if -1600 < y < -6.4999999999999995e-45Initial 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 71.4%
mul-1-neg71.4%
distribute-neg-frac271.4%
neg-sub071.4%
associate-+l-71.4%
neg-sub071.4%
+-commutative71.4%
unsub-neg71.4%
Simplified71.4%
Taylor expanded in x around inf 71.8%
distribute-lft-in71.8%
metadata-eval71.8%
neg-mul-171.8%
associate-*r/71.8%
metadata-eval71.8%
Simplified71.8%
Taylor expanded in x around 0 71.8%
sub-neg71.8%
neg-mul-171.8%
metadata-eval71.8%
+-commutative71.8%
sub-neg71.8%
Simplified71.8%
if -6.4999999999999995e-45 < y < -4.69999999999999964e-137Initial 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 88.3%
Taylor expanded in y around 0 88.3%
if -4.69999999999999964e-137 < y < 5.2000000000000002e-8Initial 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 82.5%
mul-1-neg82.5%
distribute-neg-frac282.5%
neg-sub082.5%
associate-+l-82.5%
neg-sub082.5%
+-commutative82.5%
unsub-neg82.5%
Simplified82.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (- y 2.0))))
(if (<= y -1350.0)
t_0
(if (<= y -6.5e-47)
(/ (- -2.0 x) x)
(if (<= y -4.3e-137)
(/ (- y x) -2.0)
(if (<= y 1e-7) (/ x (- 2.0 x)) t_0))))))
double code(double x, double y) {
double t_0 = y / (y - 2.0);
double tmp;
if (y <= -1350.0) {
tmp = t_0;
} else if (y <= -6.5e-47) {
tmp = (-2.0 - x) / x;
} else if (y <= -4.3e-137) {
tmp = (y - x) / -2.0;
} else if (y <= 1e-7) {
tmp = x / (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 = y / (y - 2.0d0)
if (y <= (-1350.0d0)) then
tmp = t_0
else if (y <= (-6.5d-47)) then
tmp = ((-2.0d0) - x) / x
else if (y <= (-4.3d-137)) then
tmp = (y - x) / (-2.0d0)
else if (y <= 1d-7) then
tmp = x / (2.0d0 - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y - 2.0);
double tmp;
if (y <= -1350.0) {
tmp = t_0;
} else if (y <= -6.5e-47) {
tmp = (-2.0 - x) / x;
} else if (y <= -4.3e-137) {
tmp = (y - x) / -2.0;
} else if (y <= 1e-7) {
tmp = x / (2.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y / (y - 2.0) tmp = 0 if y <= -1350.0: tmp = t_0 elif y <= -6.5e-47: tmp = (-2.0 - x) / x elif y <= -4.3e-137: tmp = (y - x) / -2.0 elif y <= 1e-7: tmp = x / (2.0 - x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y / Float64(y - 2.0)) tmp = 0.0 if (y <= -1350.0) tmp = t_0; elseif (y <= -6.5e-47) tmp = Float64(Float64(-2.0 - x) / x); elseif (y <= -4.3e-137) tmp = Float64(Float64(y - x) / -2.0); elseif (y <= 1e-7) tmp = Float64(x / Float64(2.0 - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y - 2.0); tmp = 0.0; if (y <= -1350.0) tmp = t_0; elseif (y <= -6.5e-47) tmp = (-2.0 - x) / x; elseif (y <= -4.3e-137) tmp = (y - x) / -2.0; elseif (y <= 1e-7) tmp = x / (2.0 - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1350.0], t$95$0, If[LessEqual[y, -6.5e-47], N[(N[(-2.0 - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, -4.3e-137], N[(N[(y - x), $MachinePrecision] / -2.0), $MachinePrecision], If[LessEqual[y, 1e-7], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y - 2}\\
\mathbf{if}\;y \leq -1350:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{-47}:\\
\;\;\;\;\frac{-2 - x}{x}\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{-137}:\\
\;\;\;\;\frac{y - x}{-2}\\
\mathbf{elif}\;y \leq 10^{-7}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1350 or 9.9999999999999995e-8 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 84.3%
if -1350 < y < -6.5000000000000004e-47Initial 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 71.4%
mul-1-neg71.4%
distribute-neg-frac271.4%
neg-sub071.4%
associate-+l-71.4%
neg-sub071.4%
+-commutative71.4%
unsub-neg71.4%
Simplified71.4%
Taylor expanded in x around inf 71.8%
distribute-lft-in71.8%
metadata-eval71.8%
neg-mul-171.8%
associate-*r/71.8%
metadata-eval71.8%
Simplified71.8%
Taylor expanded in x around 0 71.8%
sub-neg71.8%
neg-mul-171.8%
metadata-eval71.8%
+-commutative71.8%
sub-neg71.8%
Simplified71.8%
if -6.5000000000000004e-47 < y < -4.2999999999999998e-137Initial 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 88.3%
Taylor expanded in y around 0 88.3%
if -4.2999999999999998e-137 < y < 9.9999999999999995e-8Initial 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 82.5%
mul-1-neg82.5%
distribute-neg-frac282.5%
neg-sub082.5%
associate-+l-82.5%
neg-sub082.5%
+-commutative82.5%
unsub-neg82.5%
Simplified82.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -6800.0)
t_0
(if (<= y -3e-45)
-1.0
(if (<= y -2.45e-137) (/ y -2.0) (if (<= y 3300000.0) -1.0 t_0))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -6800.0) {
tmp = t_0;
} else if (y <= -3e-45) {
tmp = -1.0;
} else if (y <= -2.45e-137) {
tmp = y / -2.0;
} else if (y <= 3300000.0) {
tmp = -1.0;
} 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 <= (-6800.0d0)) then
tmp = t_0
else if (y <= (-3d-45)) then
tmp = -1.0d0
else if (y <= (-2.45d-137)) then
tmp = y / (-2.0d0)
else if (y <= 3300000.0d0) then
tmp = -1.0d0
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 <= -6800.0) {
tmp = t_0;
} else if (y <= -3e-45) {
tmp = -1.0;
} else if (y <= -2.45e-137) {
tmp = y / -2.0;
} else if (y <= 3300000.0) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -6800.0: tmp = t_0 elif y <= -3e-45: tmp = -1.0 elif y <= -2.45e-137: tmp = y / -2.0 elif y <= 3300000.0: tmp = -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -6800.0) tmp = t_0; elseif (y <= -3e-45) tmp = -1.0; elseif (y <= -2.45e-137) tmp = Float64(y / -2.0); elseif (y <= 3300000.0) tmp = -1.0; 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 <= -6800.0) tmp = t_0; elseif (y <= -3e-45) tmp = -1.0; elseif (y <= -2.45e-137) tmp = y / -2.0; elseif (y <= 3300000.0) tmp = -1.0; 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, -6800.0], t$95$0, If[LessEqual[y, -3e-45], -1.0, If[LessEqual[y, -2.45e-137], N[(y / -2.0), $MachinePrecision], If[LessEqual[y, 3300000.0], -1.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -6800:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-45}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -2.45 \cdot 10^{-137}:\\
\;\;\;\;\frac{y}{-2}\\
\mathbf{elif}\;y \leq 3300000:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6800 or 3.3e6 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 85.1%
Taylor expanded in y around inf 84.6%
associate--l+84.6%
associate-*r/84.6%
metadata-eval84.6%
div-sub84.6%
Simplified84.6%
Taylor expanded in x around inf 82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in x around 0 82.8%
neg-mul-182.8%
sub-neg82.8%
Simplified82.8%
if -6800 < y < -3.00000000000000011e-45 or -2.4499999999999998e-137 < y < 3.3e6Initial 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 53.7%
if -3.00000000000000011e-45 < y < -2.4499999999999998e-137Initial 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 57.8%
Taylor expanded in y around 0 57.8%
(FPCore (x y)
:precision binary64
(if (<= y -6800.0)
1.0
(if (<= y -1e-43)
-1.0
(if (<= y -3.7e-138) (/ y -2.0) (if (<= y 7000000.0) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -6800.0) {
tmp = 1.0;
} else if (y <= -1e-43) {
tmp = -1.0;
} else if (y <= -3.7e-138) {
tmp = y / -2.0;
} else if (y <= 7000000.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 (y <= (-6800.0d0)) then
tmp = 1.0d0
else if (y <= (-1d-43)) then
tmp = -1.0d0
else if (y <= (-3.7d-138)) then
tmp = y / (-2.0d0)
else if (y <= 7000000.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 (y <= -6800.0) {
tmp = 1.0;
} else if (y <= -1e-43) {
tmp = -1.0;
} else if (y <= -3.7e-138) {
tmp = y / -2.0;
} else if (y <= 7000000.0) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6800.0: tmp = 1.0 elif y <= -1e-43: tmp = -1.0 elif y <= -3.7e-138: tmp = y / -2.0 elif y <= 7000000.0: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6800.0) tmp = 1.0; elseif (y <= -1e-43) tmp = -1.0; elseif (y <= -3.7e-138) tmp = Float64(y / -2.0); elseif (y <= 7000000.0) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6800.0) tmp = 1.0; elseif (y <= -1e-43) tmp = -1.0; elseif (y <= -3.7e-138) tmp = y / -2.0; elseif (y <= 7000000.0) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6800.0], 1.0, If[LessEqual[y, -1e-43], -1.0, If[LessEqual[y, -3.7e-138], N[(y / -2.0), $MachinePrecision], If[LessEqual[y, 7000000.0], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6800:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-43}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{-2}\\
\mathbf{elif}\;y \leq 7000000:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6800 or 7e6 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if -6800 < y < -1.00000000000000008e-43 or -3.69999999999999991e-138 < y < 7e6Initial 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 53.7%
if -1.00000000000000008e-43 < y < -3.69999999999999991e-138Initial 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 57.8%
Taylor expanded in y around 0 57.8%
(FPCore (x y) :precision binary64 (if (or (<= y -1950.0) (not (<= y 6600.0))) (+ 1.0 (/ (- (- 2.0 x) x) y)) (/ (- y x) (- x 2.0))))
double code(double x, double y) {
double tmp;
if ((y <= -1950.0) || !(y <= 6600.0)) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else {
tmp = (y - x) / (x - 2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1950.0d0)) .or. (.not. (y <= 6600.0d0))) then
tmp = 1.0d0 + (((2.0d0 - x) - x) / y)
else
tmp = (y - x) / (x - 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1950.0) || !(y <= 6600.0)) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else {
tmp = (y - x) / (x - 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1950.0) or not (y <= 6600.0): tmp = 1.0 + (((2.0 - x) - x) / y) else: tmp = (y - x) / (x - 2.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1950.0) || !(y <= 6600.0)) tmp = Float64(1.0 + Float64(Float64(Float64(2.0 - x) - x) / y)); else tmp = Float64(Float64(y - x) / Float64(x - 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1950.0) || ~((y <= 6600.0))) tmp = 1.0 + (((2.0 - x) - x) / y); else tmp = (y - x) / (x - 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1950.0], N[Not[LessEqual[y, 6600.0]], $MachinePrecision]], N[(1.0 + N[(N[(N[(2.0 - x), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / N[(x - 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1950 \lor \neg \left(y \leq 6600\right):\\
\;\;\;\;1 + \frac{\left(2 - x\right) - x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{x - 2}\\
\end{array}
\end{array}
if y < -1950 or 6600 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 86.0%
associate--l+86.0%
+-commutative86.0%
mul-1-neg86.0%
unsub-neg86.0%
associate-*r/86.0%
metadata-eval86.0%
div-sub86.0%
unsub-neg86.0%
neg-mul-186.0%
+-rgt-identity86.0%
div-sub86.0%
+-rgt-identity86.0%
neg-mul-186.0%
unsub-neg86.0%
Simplified86.0%
if -1950 < y < 6600Initial 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 98.1%
Final simplification92.4%
(FPCore (x y) :precision binary64 (if (or (<= y -3700.0) (not (<= y 1.6))) (/ y (+ x (+ y -2.0))) (/ (- y x) (- x 2.0))))
double code(double x, double y) {
double tmp;
if ((y <= -3700.0) || !(y <= 1.6)) {
tmp = y / (x + (y + -2.0));
} else {
tmp = (y - x) / (x - 2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-3700.0d0)) .or. (.not. (y <= 1.6d0))) then
tmp = y / (x + (y + (-2.0d0)))
else
tmp = (y - x) / (x - 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3700.0) || !(y <= 1.6)) {
tmp = y / (x + (y + -2.0));
} else {
tmp = (y - x) / (x - 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3700.0) or not (y <= 1.6): tmp = y / (x + (y + -2.0)) else: tmp = (y - x) / (x - 2.0) return tmp
function code(x, y) tmp = 0.0 if ((y <= -3700.0) || !(y <= 1.6)) tmp = Float64(y / Float64(x + Float64(y + -2.0))); else tmp = Float64(Float64(y - x) / Float64(x - 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3700.0) || ~((y <= 1.6))) tmp = y / (x + (y + -2.0)); else tmp = (y - x) / (x - 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3700.0], N[Not[LessEqual[y, 1.6]], $MachinePrecision]], N[(y / N[(x + N[(y + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / N[(x - 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3700 \lor \neg \left(y \leq 1.6\right):\\
\;\;\;\;\frac{y}{x + \left(y + -2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{x - 2}\\
\end{array}
\end{array}
if y < -3700 or 1.6000000000000001 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 85.1%
if -3700 < y < 1.6000000000000001Initial 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 98.1%
Final simplification91.9%
(FPCore (x y) :precision binary64 (if (<= y -4500.0) (/ y (+ x (+ y -2.0))) (if (<= y 128000.0) (/ (- y x) (- x 2.0)) (/ (- y x) (- y 2.0)))))
double code(double x, double y) {
double tmp;
if (y <= -4500.0) {
tmp = y / (x + (y + -2.0));
} else if (y <= 128000.0) {
tmp = (y - x) / (x - 2.0);
} else {
tmp = (y - x) / (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 (y <= (-4500.0d0)) then
tmp = y / (x + (y + (-2.0d0)))
else if (y <= 128000.0d0) then
tmp = (y - x) / (x - 2.0d0)
else
tmp = (y - x) / (y - 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4500.0) {
tmp = y / (x + (y + -2.0));
} else if (y <= 128000.0) {
tmp = (y - x) / (x - 2.0);
} else {
tmp = (y - x) / (y - 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4500.0: tmp = y / (x + (y + -2.0)) elif y <= 128000.0: tmp = (y - x) / (x - 2.0) else: tmp = (y - x) / (y - 2.0) return tmp
function code(x, y) tmp = 0.0 if (y <= -4500.0) tmp = Float64(y / Float64(x + Float64(y + -2.0))); elseif (y <= 128000.0) tmp = Float64(Float64(y - x) / Float64(x - 2.0)); else tmp = Float64(Float64(y - x) / Float64(y - 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4500.0) tmp = y / (x + (y + -2.0)); elseif (y <= 128000.0) tmp = (y - x) / (x - 2.0); else tmp = (y - x) / (y - 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4500.0], N[(y / N[(x + N[(y + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 128000.0], N[(N[(y - x), $MachinePrecision] / N[(x - 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / N[(y - 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4500:\\
\;\;\;\;\frac{y}{x + \left(y + -2\right)}\\
\mathbf{elif}\;y \leq 128000:\\
\;\;\;\;\frac{y - x}{x - 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{y - 2}\\
\end{array}
\end{array}
if y < -4500Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 88.8%
if -4500 < y < 128000Initial 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 98.1%
if 128000 < 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 x around 0 82.2%
(FPCore (x y) :precision binary64 (if (or (<= y -980.0) (not (<= y 1.08e-8))) (/ y (- y 2.0)) (/ x (- 2.0 x))))
double code(double x, double y) {
double tmp;
if ((y <= -980.0) || !(y <= 1.08e-8)) {
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 ((y <= (-980.0d0)) .or. (.not. (y <= 1.08d-8))) 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 ((y <= -980.0) || !(y <= 1.08e-8)) {
tmp = y / (y - 2.0);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -980.0) or not (y <= 1.08e-8): tmp = y / (y - 2.0) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -980.0) || !(y <= 1.08e-8)) 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 ((y <= -980.0) || ~((y <= 1.08e-8))) tmp = y / (y - 2.0); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -980.0], N[Not[LessEqual[y, 1.08e-8]], $MachinePrecision]], N[(y / N[(y - 2.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -980 \lor \neg \left(y \leq 1.08 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{y}{y - 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if y < -980 or 1.0800000000000001e-8 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 84.3%
if -980 < y < 1.0800000000000001e-8Initial 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 75.2%
mul-1-neg75.2%
distribute-neg-frac275.2%
neg-sub075.2%
associate-+l-75.2%
neg-sub075.2%
+-commutative75.2%
unsub-neg75.2%
Simplified75.2%
Final simplification79.6%
(FPCore (x y) :precision binary64 (if (or (<= y -6800.0) (not (<= y 125000.0))) (- 1.0 (/ x y)) (/ x (- 2.0 x))))
double code(double x, double y) {
double tmp;
if ((y <= -6800.0) || !(y <= 125000.0)) {
tmp = 1.0 - (x / y);
} 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 ((y <= (-6800.0d0)) .or. (.not. (y <= 125000.0d0))) then
tmp = 1.0d0 - (x / y)
else
tmp = x / (2.0d0 - x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -6800.0) || !(y <= 125000.0)) {
tmp = 1.0 - (x / y);
} else {
tmp = x / (2.0 - x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -6800.0) or not (y <= 125000.0): tmp = 1.0 - (x / y) else: tmp = x / (2.0 - x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -6800.0) || !(y <= 125000.0)) tmp = Float64(1.0 - Float64(x / y)); else tmp = Float64(x / Float64(2.0 - x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -6800.0) || ~((y <= 125000.0))) tmp = 1.0 - (x / y); else tmp = x / (2.0 - x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -6800.0], N[Not[LessEqual[y, 125000.0]], $MachinePrecision]], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6800 \lor \neg \left(y \leq 125000\right):\\
\;\;\;\;1 - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{2 - x}\\
\end{array}
\end{array}
if y < -6800 or 125000 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 85.1%
Taylor expanded in y around inf 84.6%
associate--l+84.6%
associate-*r/84.6%
metadata-eval84.6%
div-sub84.6%
Simplified84.6%
Taylor expanded in x around inf 82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in x around 0 82.8%
neg-mul-182.8%
sub-neg82.8%
Simplified82.8%
if -6800 < y < 125000Initial 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 74.6%
mul-1-neg74.6%
distribute-neg-frac274.6%
neg-sub074.6%
associate-+l-74.6%
neg-sub074.6%
+-commutative74.6%
unsub-neg74.6%
Simplified74.6%
Final simplification78.5%
(FPCore (x y) :precision binary64 (if (<= y -6800.0) 1.0 (if (<= y 7500000.0) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -6800.0) {
tmp = 1.0;
} else if (y <= 7500000.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 (y <= (-6800.0d0)) then
tmp = 1.0d0
else if (y <= 7500000.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 (y <= -6800.0) {
tmp = 1.0;
} else if (y <= 7500000.0) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6800.0: tmp = 1.0 elif y <= 7500000.0: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -6800.0) tmp = 1.0; elseif (y <= 7500000.0) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6800.0) tmp = 1.0; elseif (y <= 7500000.0) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6800.0], 1.0, If[LessEqual[y, 7500000.0], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6800:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 7500000:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -6800 or 7.5e6 < y Initial program 99.9%
remove-double-neg99.9%
+-commutative99.9%
distribute-neg-frac299.9%
distribute-frac-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
associate-+r+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if -6800 < y < 7.5e6Initial 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 48.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%
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 32.4%
(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 2024132
(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))))