
(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 8 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
(let* ((t_0 (+ 1.0 (/ (- 1.0 x) y))))
(if (<= y -900000000000.0)
t_0
(if (<= y -3.7e-30)
(/ y (+ y -1.0))
(if (<= y 5.5e-101)
x
(if (<= y 2.3e-92) (- y) (if (<= y 28000.0) (/ x (- 1.0 y)) t_0)))))))
double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -900000000000.0) {
tmp = t_0;
} else if (y <= -3.7e-30) {
tmp = y / (y + -1.0);
} else if (y <= 5.5e-101) {
tmp = x;
} else if (y <= 2.3e-92) {
tmp = -y;
} else if (y <= 28000.0) {
tmp = x / (1.0 - y);
} 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 + ((1.0d0 - x) / y)
if (y <= (-900000000000.0d0)) then
tmp = t_0
else if (y <= (-3.7d-30)) then
tmp = y / (y + (-1.0d0))
else if (y <= 5.5d-101) then
tmp = x
else if (y <= 2.3d-92) then
tmp = -y
else if (y <= 28000.0d0) then
tmp = x / (1.0d0 - y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((1.0 - x) / y);
double tmp;
if (y <= -900000000000.0) {
tmp = t_0;
} else if (y <= -3.7e-30) {
tmp = y / (y + -1.0);
} else if (y <= 5.5e-101) {
tmp = x;
} else if (y <= 2.3e-92) {
tmp = -y;
} else if (y <= 28000.0) {
tmp = x / (1.0 - y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((1.0 - x) / y) tmp = 0 if y <= -900000000000.0: tmp = t_0 elif y <= -3.7e-30: tmp = y / (y + -1.0) elif y <= 5.5e-101: tmp = x elif y <= 2.3e-92: tmp = -y elif y <= 28000.0: tmp = x / (1.0 - y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(1.0 - x) / y)) tmp = 0.0 if (y <= -900000000000.0) tmp = t_0; elseif (y <= -3.7e-30) tmp = Float64(y / Float64(y + -1.0)); elseif (y <= 5.5e-101) tmp = x; elseif (y <= 2.3e-92) tmp = Float64(-y); elseif (y <= 28000.0) tmp = Float64(x / Float64(1.0 - y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((1.0 - x) / y); tmp = 0.0; if (y <= -900000000000.0) tmp = t_0; elseif (y <= -3.7e-30) tmp = y / (y + -1.0); elseif (y <= 5.5e-101) tmp = x; elseif (y <= 2.3e-92) tmp = -y; elseif (y <= 28000.0) tmp = x / (1.0 - y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -900000000000.0], t$95$0, If[LessEqual[y, -3.7e-30], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-101], x, If[LessEqual[y, 2.3e-92], (-y), If[LessEqual[y, 28000.0], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -900000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-30}:\\
\;\;\;\;\frac{y}{y + -1}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-101}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-92}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 28000:\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -9e11 or 28000 < 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 99.7%
+-commutative99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
div-sub99.7%
unsub-neg99.7%
mul-1-neg99.7%
+-commutative99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
associate-*r/99.7%
+-commutative99.7%
associate-*r/99.7%
sub-neg99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
if -9e11 < y < -3.7000000000000003e-30Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 92.3%
if -3.7000000000000003e-30 < y < 5.49999999999999973e-101Initial 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 87.5%
if 5.49999999999999973e-101 < y < 2.30000000000000016e-92Initial 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 0 86.9%
Taylor expanded in y around 0 86.9%
mul-1-neg86.9%
Simplified86.9%
if 2.30000000000000016e-92 < y < 28000Initial 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 inf 58.0%
sub-neg58.0%
metadata-eval58.0%
neg-mul-158.0%
distribute-neg-frac58.0%
+-commutative58.0%
Simplified58.0%
frac-2neg58.0%
div-inv58.0%
remove-double-neg58.0%
+-commutative58.0%
Applied egg-rr58.0%
associate-*r/58.0%
*-rgt-identity58.0%
neg-sub058.0%
+-commutative58.0%
associate--r+58.0%
metadata-eval58.0%
Simplified58.0%
Final simplification90.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 1.0 y))))
(if (<= y -2e+38)
1.0
(if (<= y 5.5e-101)
t_0
(if (<= y 2.3e-92) (- y) (if (<= y 3.6e+16) t_0 1.0))))))
double code(double x, double y) {
double t_0 = x / (1.0 - y);
double tmp;
if (y <= -2e+38) {
tmp = 1.0;
} else if (y <= 5.5e-101) {
tmp = t_0;
} else if (y <= 2.3e-92) {
tmp = -y;
} else if (y <= 3.6e+16) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x / (1.0d0 - y)
if (y <= (-2d+38)) then
tmp = 1.0d0
else if (y <= 5.5d-101) then
tmp = t_0
else if (y <= 2.3d-92) then
tmp = -y
else if (y <= 3.6d+16) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (1.0 - y);
double tmp;
if (y <= -2e+38) {
tmp = 1.0;
} else if (y <= 5.5e-101) {
tmp = t_0;
} else if (y <= 2.3e-92) {
tmp = -y;
} else if (y <= 3.6e+16) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (1.0 - y) tmp = 0 if y <= -2e+38: tmp = 1.0 elif y <= 5.5e-101: tmp = t_0 elif y <= 2.3e-92: tmp = -y elif y <= 3.6e+16: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(1.0 - y)) tmp = 0.0 if (y <= -2e+38) tmp = 1.0; elseif (y <= 5.5e-101) tmp = t_0; elseif (y <= 2.3e-92) tmp = Float64(-y); elseif (y <= 3.6e+16) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (1.0 - y); tmp = 0.0; if (y <= -2e+38) tmp = 1.0; elseif (y <= 5.5e-101) tmp = t_0; elseif (y <= 2.3e-92) tmp = -y; elseif (y <= 3.6e+16) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+38], 1.0, If[LessEqual[y, 5.5e-101], t$95$0, If[LessEqual[y, 2.3e-92], (-y), If[LessEqual[y, 3.6e+16], t$95$0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - y}\\
\mathbf{if}\;y \leq -2 \cdot 10^{+38}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-101}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-92}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.99999999999999995e38 or 3.6e16 < 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 77.6%
if -1.99999999999999995e38 < y < 5.49999999999999973e-101 or 2.30000000000000016e-92 < y < 3.6e16Initial 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 74.8%
sub-neg74.8%
metadata-eval74.8%
neg-mul-174.8%
distribute-neg-frac74.8%
+-commutative74.8%
Simplified74.8%
frac-2neg74.8%
div-inv74.8%
remove-double-neg74.8%
+-commutative74.8%
Applied egg-rr74.8%
associate-*r/74.8%
*-rgt-identity74.8%
neg-sub074.8%
+-commutative74.8%
associate--r+74.8%
metadata-eval74.8%
Simplified74.8%
if 5.49999999999999973e-101 < y < 2.30000000000000016e-92Initial 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 0 86.9%
Taylor expanded in y around 0 86.9%
mul-1-neg86.9%
Simplified86.9%
Final simplification76.4%
(FPCore (x y)
:precision binary64
(if (<= y -0.75)
1.0
(if (<= y -2.2e-29)
(* y (- -1.0 y))
(if (<= y 5.5e-101) x (if (<= y 2.3e-92) (- y) (if (<= y 1.0) x 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -0.75) {
tmp = 1.0;
} else if (y <= -2.2e-29) {
tmp = y * (-1.0 - y);
} else if (y <= 5.5e-101) {
tmp = x;
} else if (y <= 2.3e-92) {
tmp = -y;
} 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 <= (-0.75d0)) then
tmp = 1.0d0
else if (y <= (-2.2d-29)) then
tmp = y * ((-1.0d0) - y)
else if (y <= 5.5d-101) then
tmp = x
else if (y <= 2.3d-92) then
tmp = -y
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 <= -0.75) {
tmp = 1.0;
} else if (y <= -2.2e-29) {
tmp = y * (-1.0 - y);
} else if (y <= 5.5e-101) {
tmp = x;
} else if (y <= 2.3e-92) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.75: tmp = 1.0 elif y <= -2.2e-29: tmp = y * (-1.0 - y) elif y <= 5.5e-101: tmp = x elif y <= 2.3e-92: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -0.75) tmp = 1.0; elseif (y <= -2.2e-29) tmp = Float64(y * Float64(-1.0 - y)); elseif (y <= 5.5e-101) tmp = x; elseif (y <= 2.3e-92) tmp = Float64(-y); 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 <= -0.75) tmp = 1.0; elseif (y <= -2.2e-29) tmp = y * (-1.0 - y); elseif (y <= 5.5e-101) tmp = x; elseif (y <= 2.3e-92) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.75], 1.0, If[LessEqual[y, -2.2e-29], N[(y * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-101], x, If[LessEqual[y, 2.3e-92], (-y), If[LessEqual[y, 1.0], x, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.75:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-29}:\\
\;\;\;\;y \cdot \left(-1 - y\right)\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-101}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-92}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -0.75 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 73.3%
if -0.75 < y < -2.1999999999999999e-29Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
times-frac99.6%
metadata-eval99.6%
*-lft-identity99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 87.5%
Taylor expanded in y around 0 76.3%
associate-+r+76.3%
mul-1-neg76.3%
unsub-neg76.3%
unpow276.3%
associate-*r*76.3%
*-commutative76.3%
associate-*r*76.3%
mul-1-neg76.3%
cube-mult76.3%
distribute-rgt-neg-out76.3%
distribute-lft-out76.3%
mul-1-neg76.3%
distribute-neg-in76.3%
+-commutative76.3%
fma-def76.3%
Simplified76.3%
Taylor expanded in y around 0 72.7%
neg-mul-172.7%
+-commutative72.7%
unpow272.7%
neg-mul-172.7%
sub-neg72.7%
neg-mul-172.7%
distribute-rgt-out--72.7%
Simplified72.7%
if -2.1999999999999999e-29 < y < 5.49999999999999973e-101 or 2.30000000000000016e-92 < 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 80.7%
if 5.49999999999999973e-101 < y < 2.30000000000000016e-92Initial 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 0 86.9%
Taylor expanded in y around 0 86.9%
mul-1-neg86.9%
Simplified86.9%
Final simplification76.9%
(FPCore (x y) :precision binary64 (if (<= y -3.95e-25) 1.0 (if (<= y 5.5e-101) x (if (<= y 1.15e-86) (- y) (if (<= y 1.0) x 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -3.95e-25) {
tmp = 1.0;
} else if (y <= 5.5e-101) {
tmp = x;
} else if (y <= 1.15e-86) {
tmp = -y;
} 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 <= (-3.95d-25)) then
tmp = 1.0d0
else if (y <= 5.5d-101) then
tmp = x
else if (y <= 1.15d-86) then
tmp = -y
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 <= -3.95e-25) {
tmp = 1.0;
} else if (y <= 5.5e-101) {
tmp = x;
} else if (y <= 1.15e-86) {
tmp = -y;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.95e-25: tmp = 1.0 elif y <= 5.5e-101: tmp = x elif y <= 1.15e-86: tmp = -y elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.95e-25) tmp = 1.0; elseif (y <= 5.5e-101) tmp = x; elseif (y <= 1.15e-86) tmp = Float64(-y); 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 <= -3.95e-25) tmp = 1.0; elseif (y <= 5.5e-101) tmp = x; elseif (y <= 1.15e-86) tmp = -y; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.95e-25], 1.0, If[LessEqual[y, 5.5e-101], x, If[LessEqual[y, 1.15e-86], (-y), If[LessEqual[y, 1.0], x, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.95 \cdot 10^{-25}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-101}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.9499999999999998e-25 or 1 < 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 y around inf 71.0%
if -3.9499999999999998e-25 < y < 5.49999999999999973e-101 or 1.14999999999999998e-86 < 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 79.6%
if 5.49999999999999973e-101 < y < 1.14999999999999998e-86Initial 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 0 86.9%
Taylor expanded in y around 0 86.9%
mul-1-neg86.9%
Simplified86.9%
Final simplification75.3%
(FPCore (x y) :precision binary64 (if (or (<= x -3e-51) (not (<= x 1.55e-25))) (/ x (- 1.0 y)) (/ y (+ y -1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -3e-51) || !(x <= 1.55e-25)) {
tmp = x / (1.0 - y);
} else {
tmp = y / (y + -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 <= (-3d-51)) .or. (.not. (x <= 1.55d-25))) then
tmp = x / (1.0d0 - y)
else
tmp = y / (y + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -3e-51) || !(x <= 1.55e-25)) {
tmp = x / (1.0 - y);
} else {
tmp = y / (y + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -3e-51) or not (x <= 1.55e-25): tmp = x / (1.0 - y) else: tmp = y / (y + -1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -3e-51) || !(x <= 1.55e-25)) tmp = Float64(x / Float64(1.0 - y)); else tmp = Float64(y / Float64(y + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -3e-51) || ~((x <= 1.55e-25))) tmp = x / (1.0 - y); else tmp = y / (y + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -3e-51], N[Not[LessEqual[x, 1.55e-25]], $MachinePrecision]], N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-51} \lor \neg \left(x \leq 1.55 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{x}{1 - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -1}\\
\end{array}
\end{array}
if x < -3.00000000000000002e-51 or 1.54999999999999997e-25 < x 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 x around inf 75.1%
sub-neg75.1%
metadata-eval75.1%
neg-mul-175.1%
distribute-neg-frac75.1%
+-commutative75.1%
Simplified75.1%
frac-2neg75.1%
div-inv75.1%
remove-double-neg75.1%
+-commutative75.1%
Applied egg-rr75.1%
associate-*r/75.1%
*-rgt-identity75.1%
neg-sub075.1%
+-commutative75.1%
associate--r+75.1%
metadata-eval75.1%
Simplified75.1%
if -3.00000000000000002e-51 < x < 1.54999999999999997e-25Initial 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 0 84.5%
Final simplification79.3%
(FPCore (x y) :precision binary64 (if (<= y -3.95e-25) 1.0 (if (<= y 1.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -3.95e-25) {
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 <= (-3.95d-25)) 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 <= -3.95e-25) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.95e-25: tmp = 1.0 elif y <= 1.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -3.95e-25) 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 <= -3.95e-25) tmp = 1.0; elseif (y <= 1.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.95e-25], 1.0, If[LessEqual[y, 1.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.95 \cdot 10^{-25}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.9499999999999998e-25 or 1 < 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 y around inf 71.0%
if -3.9499999999999998e-25 < 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.2%
Final simplification73.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%
Taylor expanded in y around inf 38.2%
Final simplification38.2%
herbie shell --seed 2023255
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, C"
:precision binary64
(/ (- x y) (- 1.0 y)))