
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
double code(double x, double y) {
return (x - y) / (1.0 - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (1.0d0 - y)
end function
public static double code(double x, double y) {
return (x - y) / (1.0 - y);
}
def code(x, y): return (x - y) / (1.0 - y)
function code(x, y) return Float64(Float64(x - y) / Float64(1.0 - y)) end
function tmp = code(x, y) tmp = (x - y) / (1.0 - y); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{1 - y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -7.2e+95)
1.0
(if (<= y -8.2e+68)
(/ (- x) y)
(if (or (<= y -16200000000.0) (not (<= y 500000000000.0)))
(/ y (+ y -1.0))
(/ x (- 1.0 y))))))
double code(double x, double y) {
double tmp;
if (y <= -7.2e+95) {
tmp = 1.0;
} else if (y <= -8.2e+68) {
tmp = -x / y;
} else if ((y <= -16200000000.0) || !(y <= 500000000000.0)) {
tmp = y / (y + -1.0);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7.2d+95)) then
tmp = 1.0d0
else if (y <= (-8.2d+68)) then
tmp = -x / y
else if ((y <= (-16200000000.0d0)) .or. (.not. (y <= 500000000000.0d0))) then
tmp = y / (y + (-1.0d0))
else
tmp = x / (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.2e+95) {
tmp = 1.0;
} else if (y <= -8.2e+68) {
tmp = -x / y;
} else if ((y <= -16200000000.0) || !(y <= 500000000000.0)) {
tmp = y / (y + -1.0);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.2e+95: tmp = 1.0 elif y <= -8.2e+68: tmp = -x / y elif (y <= -16200000000.0) or not (y <= 500000000000.0): tmp = y / (y + -1.0) else: tmp = x / (1.0 - y) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.2e+95) tmp = 1.0; elseif (y <= -8.2e+68) tmp = Float64(Float64(-x) / y); elseif ((y <= -16200000000.0) || !(y <= 500000000000.0)) tmp = Float64(y / Float64(y + -1.0)); else tmp = Float64(x / Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.2e+95) tmp = 1.0; elseif (y <= -8.2e+68) tmp = -x / y; elseif ((y <= -16200000000.0) || ~((y <= 500000000000.0))) tmp = y / (y + -1.0); else tmp = x / (1.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.2e+95], 1.0, If[LessEqual[y, -8.2e+68], N[((-x) / y), $MachinePrecision], If[Or[LessEqual[y, -16200000000.0], N[Not[LessEqual[y, 500000000000.0]], $MachinePrecision]], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+95}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{+68}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -16200000000 \lor \neg \left(y \leq 500000000000\right):\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - y}\\
\end{array}
\end{array}
if y < -7.19999999999999955e95Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 93.9%
if -7.19999999999999955e95 < y < -8.1999999999999998e68Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
Simplified100.0%
if -8.1999999999999998e68 < y < -1.62e10 or 5e11 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
times-frac99.9%
metadata-eval99.9%
*-lft-identity99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 84.1%
if -1.62e10 < y < 5e11Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
frac-2neg99.8%
metadata-eval99.8%
metadata-eval99.8%
sub-neg99.8%
sub-neg99.8%
add-sqr-sqrt54.3%
sqrt-prod88.9%
sqr-neg88.9%
sqrt-unprod38.2%
add-sqr-sqrt80.1%
add-sqr-sqrt35.7%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod0.7%
add-sqr-sqrt1.4%
distribute-neg-in1.4%
sub-neg1.4%
distribute-frac-neg1.4%
Applied egg-rr80.1%
Taylor expanded in x around inf 80.5%
Taylor expanded in x around 0 80.6%
metadata-eval80.6%
sub-neg80.6%
metadata-eval80.6%
+-commutative80.6%
times-frac80.6%
*-lft-identity80.6%
neg-mul-180.6%
distribute-neg-in80.6%
metadata-eval80.6%
unsub-neg80.6%
Simplified80.6%
Final simplification84.5%
(FPCore (x y)
:precision binary64
(if (<= y -2.8e+96)
1.0
(if (<= y -2.2e+69)
(/ (- x) y)
(if (<= y -0.6) 1.0 (if (<= y 1.0) (+ x (* x y)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -2.8e+96) {
tmp = 1.0;
} else if (y <= -2.2e+69) {
tmp = -x / y;
} else if (y <= -0.6) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x + (x * y);
} 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 <= (-2.8d+96)) then
tmp = 1.0d0
else if (y <= (-2.2d+69)) then
tmp = -x / y
else if (y <= (-0.6d0)) then
tmp = 1.0d0
else if (y <= 1.0d0) then
tmp = x + (x * y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.8e+96) {
tmp = 1.0;
} else if (y <= -2.2e+69) {
tmp = -x / y;
} else if (y <= -0.6) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x + (x * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.8e+96: tmp = 1.0 elif y <= -2.2e+69: tmp = -x / y elif y <= -0.6: tmp = 1.0 elif y <= 1.0: tmp = x + (x * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -2.8e+96) tmp = 1.0; elseif (y <= -2.2e+69) tmp = Float64(Float64(-x) / y); elseif (y <= -0.6) tmp = 1.0; elseif (y <= 1.0) tmp = Float64(x + Float64(x * y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.8e+96) tmp = 1.0; elseif (y <= -2.2e+69) tmp = -x / y; elseif (y <= -0.6) tmp = 1.0; elseif (y <= 1.0) tmp = x + (x * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.8e+96], 1.0, If[LessEqual[y, -2.2e+69], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -0.6], 1.0, If[LessEqual[y, 1.0], N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+96}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{+69}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -0.6:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.8e96 or -2.2000000000000002e69 < y < -0.599999999999999978 or 1 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 83.4%
if -2.8e96 < y < -2.2000000000000002e69Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
Simplified100.0%
if -0.599999999999999978 < y < 1Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 79.6%
sub-neg79.6%
metadata-eval79.6%
neg-mul-179.6%
distribute-neg-frac79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in y around 0 78.6%
Final simplification81.5%
(FPCore (x y)
:precision binary64
(if (<= y -3e+99)
1.0
(if (<= y -2.6e+69)
(/ (- x) y)
(if (<= y -21000000000.0) 1.0 (if (<= y 5.1e+16) (/ x (- 1.0 y)) 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3e+99) {
tmp = 1.0;
} else if (y <= -2.6e+69) {
tmp = -x / y;
} else if (y <= -21000000000.0) {
tmp = 1.0;
} else if (y <= 5.1e+16) {
tmp = x / (1.0 - y);
} 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 <= (-3d+99)) then
tmp = 1.0d0
else if (y <= (-2.6d+69)) then
tmp = -x / y
else if (y <= (-21000000000.0d0)) then
tmp = 1.0d0
else if (y <= 5.1d+16) then
tmp = x / (1.0d0 - y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3e+99) {
tmp = 1.0;
} else if (y <= -2.6e+69) {
tmp = -x / y;
} else if (y <= -21000000000.0) {
tmp = 1.0;
} else if (y <= 5.1e+16) {
tmp = x / (1.0 - y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3e+99: tmp = 1.0 elif y <= -2.6e+69: tmp = -x / y elif y <= -21000000000.0: tmp = 1.0 elif y <= 5.1e+16: tmp = x / (1.0 - y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3e+99) tmp = 1.0; elseif (y <= -2.6e+69) tmp = Float64(Float64(-x) / y); elseif (y <= -21000000000.0) tmp = 1.0; elseif (y <= 5.1e+16) tmp = Float64(x / Float64(1.0 - y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3e+99) tmp = 1.0; elseif (y <= -2.6e+69) tmp = -x / y; elseif (y <= -21000000000.0) tmp = 1.0; elseif (y <= 5.1e+16) tmp = x / (1.0 - y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3e+99], 1.0, If[LessEqual[y, -2.6e+69], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -21000000000.0], 1.0, If[LessEqual[y, 5.1e+16], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+99}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{+69}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -21000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.00000000000000014e99 or -2.6000000000000002e69 < y < -2.1e10 or 5.1e16 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 88.0%
if -3.00000000000000014e99 < y < -2.6000000000000002e69Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
Simplified100.0%
if -2.1e10 < y < 5.1e16Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
frac-2neg99.8%
metadata-eval99.8%
metadata-eval99.8%
sub-neg99.8%
sub-neg99.8%
add-sqr-sqrt55.0%
sqrt-prod89.1%
sqr-neg89.1%
sqrt-unprod37.6%
add-sqr-sqrt79.6%
add-sqr-sqrt35.2%
sqrt-unprod19.8%
sqr-neg19.8%
sqrt-unprod0.7%
add-sqr-sqrt1.4%
distribute-neg-in1.4%
sub-neg1.4%
distribute-frac-neg1.4%
Applied egg-rr79.6%
Taylor expanded in x around inf 80.0%
Taylor expanded in x around 0 80.2%
metadata-eval80.2%
sub-neg80.2%
metadata-eval80.2%
+-commutative80.2%
times-frac80.2%
*-lft-identity80.2%
neg-mul-180.2%
distribute-neg-in80.2%
metadata-eval80.2%
unsub-neg80.2%
Simplified80.2%
Final simplification84.4%
(FPCore (x y) :precision binary64 (if (or (<= y -15500000000.0) (not (<= y 460000000000.0))) (+ 1.0 (/ (- 1.0 x) y)) (/ x (- 1.0 y))))
double code(double x, double y) {
double tmp;
if ((y <= -15500000000.0) || !(y <= 460000000000.0)) {
tmp = 1.0 + ((1.0 - x) / y);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-15500000000.0d0)) .or. (.not. (y <= 460000000000.0d0))) then
tmp = 1.0d0 + ((1.0d0 - x) / y)
else
tmp = x / (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -15500000000.0) || !(y <= 460000000000.0)) {
tmp = 1.0 + ((1.0 - x) / y);
} else {
tmp = x / (1.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -15500000000.0) or not (y <= 460000000000.0): tmp = 1.0 + ((1.0 - x) / y) else: tmp = x / (1.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -15500000000.0) || !(y <= 460000000000.0)) tmp = Float64(1.0 + Float64(Float64(1.0 - x) / y)); else tmp = Float64(x / Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -15500000000.0) || ~((y <= 460000000000.0))) tmp = 1.0 + ((1.0 - x) / y); else tmp = x / (1.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -15500000000.0], N[Not[LessEqual[y, 460000000000.0]], $MachinePrecision]], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15500000000 \lor \neg \left(y \leq 460000000000\right):\\
\;\;\;\;1 + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - y}\\
\end{array}
\end{array}
if y < -1.55e10 or 4.6e11 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-+r+100.0%
mul-1-neg100.0%
unsub-neg100.0%
div-sub100.0%
unsub-neg100.0%
mul-1-neg100.0%
+-commutative100.0%
metadata-eval100.0%
distribute-lft-in100.0%
metadata-eval100.0%
sub-neg100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in100.0%
metadata-eval100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if -1.55e10 < y < 4.6e11Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
frac-2neg99.8%
metadata-eval99.8%
metadata-eval99.8%
sub-neg99.8%
sub-neg99.8%
add-sqr-sqrt54.3%
sqrt-prod88.9%
sqr-neg88.9%
sqrt-unprod38.2%
add-sqr-sqrt80.1%
add-sqr-sqrt35.7%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod0.7%
add-sqr-sqrt1.4%
distribute-neg-in1.4%
sub-neg1.4%
distribute-frac-neg1.4%
Applied egg-rr80.1%
Taylor expanded in x around inf 80.5%
Taylor expanded in x around 0 80.6%
metadata-eval80.6%
sub-neg80.6%
metadata-eval80.6%
+-commutative80.6%
times-frac80.6%
*-lft-identity80.6%
neg-mul-180.6%
distribute-neg-in80.6%
metadata-eval80.6%
unsub-neg80.6%
Simplified80.6%
Final simplification90.7%
(FPCore (x y)
:precision binary64
(if (<= y -7.2e+95)
1.0
(if (<= y -2.8e+69)
(/ (- x) y)
(if (<= y -15500000000.0) 1.0 (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -7.2e+95) {
tmp = 1.0;
} else if (y <= -2.8e+69) {
tmp = -x / y;
} else if (y <= -15500000000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = 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 <= (-7.2d+95)) then
tmp = 1.0d0
else if (y <= (-2.8d+69)) then
tmp = -x / y
else if (y <= (-15500000000.0d0)) then
tmp = 1.0d0
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.2e+95) {
tmp = 1.0;
} else if (y <= -2.8e+69) {
tmp = -x / y;
} else if (y <= -15500000000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.2e+95: tmp = 1.0 elif y <= -2.8e+69: tmp = -x / y elif y <= -15500000000.0: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7.2e+95) tmp = 1.0; elseif (y <= -2.8e+69) tmp = Float64(Float64(-x) / y); elseif (y <= -15500000000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.2e+95) tmp = 1.0; elseif (y <= -2.8e+69) tmp = -x / y; elseif (y <= -15500000000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.2e+95], 1.0, If[LessEqual[y, -2.8e+69], N[((-x) / y), $MachinePrecision], If[LessEqual[y, -15500000000.0], 1.0, If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+95}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{+69}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;y \leq -15500000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.19999999999999955e95 or -2.79999999999999982e69 < y < -1.55e10 or 1 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 84.7%
if -7.19999999999999955e95 < y < -2.79999999999999982e69Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
neg-mul-1100.0%
distribute-neg-frac100.0%
Simplified100.0%
if -1.55e10 < y < 1Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 76.9%
Final simplification81.4%
(FPCore (x y) :precision binary64 (if (<= y -15500000000.0) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -15500000000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = 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 <= (-15500000000.0d0)) then
tmp = 1.0d0
else if (y <= 1.0d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -15500000000.0) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -15500000000.0: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -15500000000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -15500000000.0) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -15500000000.0], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15500000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.55e10 or 1 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 81.7%
if -1.55e10 < y < 1Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 76.9%
Final simplification79.5%
(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%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
frac-2neg99.9%
metadata-eval99.9%
metadata-eval99.9%
sub-neg99.9%
sub-neg99.9%
add-sqr-sqrt50.8%
sqrt-prod60.1%
sqr-neg60.1%
sqrt-unprod22.5%
add-sqr-sqrt46.8%
add-sqr-sqrt20.1%
sqrt-unprod11.3%
sqr-neg11.3%
sqrt-unprod0.7%
add-sqr-sqrt1.5%
distribute-neg-in1.5%
sub-neg1.5%
distribute-frac-neg1.5%
Applied egg-rr46.8%
Taylor expanded in y around inf 2.8%
Final simplification2.8%
(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%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-lft-identity100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 45.2%
Final simplification45.2%
herbie shell --seed 2023175
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))