
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) y)))
(if (<= y -320000.0)
(+ x (/ (- (- 1.0 x) t_0) y))
(if (<= y 12000.0)
(fma y (/ (- 1.0 x) (- -1.0 y)) 1.0)
(+ x (/ (- (- (/ (- t_0 (- 1.0 x)) y) -1.0) x) y))))))
double code(double x, double y) {
double t_0 = (1.0 - x) / y;
double tmp;
if (y <= -320000.0) {
tmp = x + (((1.0 - x) - t_0) / y);
} else if (y <= 12000.0) {
tmp = fma(y, ((1.0 - x) / (-1.0 - y)), 1.0);
} else {
tmp = x + (((((t_0 - (1.0 - x)) / y) - -1.0) - x) / y);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(1.0 - x) / y) tmp = 0.0 if (y <= -320000.0) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) - t_0) / y)); elseif (y <= 12000.0) tmp = fma(y, Float64(Float64(1.0 - x) / Float64(-1.0 - y)), 1.0); else tmp = Float64(x + Float64(Float64(Float64(Float64(Float64(t_0 - Float64(1.0 - x)) / y) - -1.0) - x) / y)); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -320000.0], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] - t$95$0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 12000.0], N[(y * N[(N[(1.0 - x), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(x + N[(N[(N[(N[(N[(t$95$0 - N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -320000:\\
\;\;\;\;x + \frac{\left(1 - x\right) - t\_0}{y}\\
\mathbf{elif}\;y \leq 12000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{1 - x}{-1 - y}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(\frac{t\_0 - \left(1 - x\right)}{y} - -1\right) - x}{y}\\
\end{array}
\end{array}
if y < -3.2e5Initial program 36.0%
associate-/l*58.1%
remove-double-neg58.1%
remove-double-neg58.1%
+-commutative58.1%
Simplified58.1%
Taylor expanded in y around inf 100.0%
Simplified100.0%
if -3.2e5 < y < 12000Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
fma-define99.9%
distribute-frac-neg299.9%
+-commutative99.9%
distribute-neg-in99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
if 12000 < y Initial program 30.8%
associate-/l*41.0%
remove-double-neg41.0%
remove-double-neg41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in y around -inf 100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* y (- 1.0 x)) (+ y 1.0))))
(if (or (<= t_0 0.99) (not (<= t_0 2.0)))
(+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))
(+ x (/ (+ 1.0 (/ -1.0 y)) y)))))
double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (y + 1.0);
double tmp;
if ((t_0 <= 0.99) || !(t_0 <= 2.0)) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else {
tmp = x + ((1.0 + (-1.0 / y)) / y);
}
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 * (1.0d0 - x)) / (y + 1.0d0)
if ((t_0 <= 0.99d0) .or. (.not. (t_0 <= 2.0d0))) then
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - y)))
else
tmp = x + ((1.0d0 + ((-1.0d0) / y)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (y + 1.0);
double tmp;
if ((t_0 <= 0.99) || !(t_0 <= 2.0)) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else {
tmp = x + ((1.0 + (-1.0 / y)) / y);
}
return tmp;
}
def code(x, y): t_0 = (y * (1.0 - x)) / (y + 1.0) tmp = 0 if (t_0 <= 0.99) or not (t_0 <= 2.0): tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) else: tmp = x + ((1.0 + (-1.0 / y)) / y) return tmp
function code(x, y) t_0 = Float64(Float64(y * Float64(1.0 - x)) / Float64(y + 1.0)) tmp = 0.0 if ((t_0 <= 0.99) || !(t_0 <= 2.0)) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); else tmp = Float64(x + Float64(Float64(1.0 + Float64(-1.0 / y)) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * (1.0 - x)) / (y + 1.0); tmp = 0.0; if ((t_0 <= 0.99) || ~((t_0 <= 2.0))) tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); else tmp = x + ((1.0 + (-1.0 / y)) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.99], N[Not[LessEqual[t$95$0, 2.0]], $MachinePrecision]], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\mathbf{if}\;t\_0 \leq 0.99 \lor \neg \left(t\_0 \leq 2\right):\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1 + \frac{-1}{y}}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.98999999999999999 or 2 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 88.3%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
if 0.98999999999999999 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 2Initial program 6.7%
associate-/l*6.7%
remove-double-neg6.7%
remove-double-neg6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in y around inf 99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) y)))
(if (<= y -280000.0)
(+ x (/ (- (- 1.0 x) t_0) y))
(if (<= y 12000.0)
(+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))
(+ x (/ (- (- (/ (- t_0 (- 1.0 x)) y) -1.0) x) y))))))
double code(double x, double y) {
double t_0 = (1.0 - x) / y;
double tmp;
if (y <= -280000.0) {
tmp = x + (((1.0 - x) - t_0) / y);
} else if (y <= 12000.0) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else {
tmp = x + (((((t_0 - (1.0 - x)) / y) - -1.0) - x) / y);
}
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 <= (-280000.0d0)) then
tmp = x + (((1.0d0 - x) - t_0) / y)
else if (y <= 12000.0d0) then
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - y)))
else
tmp = x + (((((t_0 - (1.0d0 - x)) / y) - (-1.0d0)) - x) / y)
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 <= -280000.0) {
tmp = x + (((1.0 - x) - t_0) / y);
} else if (y <= 12000.0) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else {
tmp = x + (((((t_0 - (1.0 - x)) / y) - -1.0) - x) / y);
}
return tmp;
}
def code(x, y): t_0 = (1.0 - x) / y tmp = 0 if y <= -280000.0: tmp = x + (((1.0 - x) - t_0) / y) elif y <= 12000.0: tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) else: tmp = x + (((((t_0 - (1.0 - x)) / y) - -1.0) - x) / y) return tmp
function code(x, y) t_0 = Float64(Float64(1.0 - x) / y) tmp = 0.0 if (y <= -280000.0) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) - t_0) / y)); elseif (y <= 12000.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); else tmp = Float64(x + Float64(Float64(Float64(Float64(Float64(t_0 - Float64(1.0 - x)) / y) - -1.0) - x) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 - x) / y; tmp = 0.0; if (y <= -280000.0) tmp = x + (((1.0 - x) - t_0) / y); elseif (y <= 12000.0) tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); else tmp = x + (((((t_0 - (1.0 - x)) / y) - -1.0) - x) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -280000.0], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] - t$95$0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 12000.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(N[(N[(t$95$0 - N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -280000:\\
\;\;\;\;x + \frac{\left(1 - x\right) - t\_0}{y}\\
\mathbf{elif}\;y \leq 12000:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(\frac{t\_0 - \left(1 - x\right)}{y} - -1\right) - x}{y}\\
\end{array}
\end{array}
if y < -2.8e5Initial program 36.0%
associate-/l*58.1%
remove-double-neg58.1%
remove-double-neg58.1%
+-commutative58.1%
Simplified58.1%
Taylor expanded in y around inf 100.0%
Simplified100.0%
if -2.8e5 < y < 12000Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
if 12000 < y Initial program 30.8%
associate-/l*41.0%
remove-double-neg41.0%
remove-double-neg41.0%
+-commutative41.0%
Simplified41.0%
Taylor expanded in y around -inf 100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ y (+ y 1.0)))))
(if (<= y -3.1e-9)
t_0
(if (<= y 3e-12)
(+ 1.0 (* y x))
(if (<= y 1.25e+64) t_0 (if (<= y 1.8e+114) (/ 1.0 y) x))))))
double code(double x, double y) {
double t_0 = x * (y / (y + 1.0));
double tmp;
if (y <= -3.1e-9) {
tmp = t_0;
} else if (y <= 3e-12) {
tmp = 1.0 + (y * x);
} else if (y <= 1.25e+64) {
tmp = t_0;
} else if (y <= 1.8e+114) {
tmp = 1.0 / y;
} else {
tmp = x;
}
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 * (y / (y + 1.0d0))
if (y <= (-3.1d-9)) then
tmp = t_0
else if (y <= 3d-12) then
tmp = 1.0d0 + (y * x)
else if (y <= 1.25d+64) then
tmp = t_0
else if (y <= 1.8d+114) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y / (y + 1.0));
double tmp;
if (y <= -3.1e-9) {
tmp = t_0;
} else if (y <= 3e-12) {
tmp = 1.0 + (y * x);
} else if (y <= 1.25e+64) {
tmp = t_0;
} else if (y <= 1.8e+114) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): t_0 = x * (y / (y + 1.0)) tmp = 0 if y <= -3.1e-9: tmp = t_0 elif y <= 3e-12: tmp = 1.0 + (y * x) elif y <= 1.25e+64: tmp = t_0 elif y <= 1.8e+114: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) t_0 = Float64(x * Float64(y / Float64(y + 1.0))) tmp = 0.0 if (y <= -3.1e-9) tmp = t_0; elseif (y <= 3e-12) tmp = Float64(1.0 + Float64(y * x)); elseif (y <= 1.25e+64) tmp = t_0; elseif (y <= 1.8e+114) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y / (y + 1.0)); tmp = 0.0; if (y <= -3.1e-9) tmp = t_0; elseif (y <= 3e-12) tmp = 1.0 + (y * x); elseif (y <= 1.25e+64) tmp = t_0; elseif (y <= 1.8e+114) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.1e-9], t$95$0, If[LessEqual[y, 3e-12], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+64], t$95$0, If[LessEqual[y, 1.8e+114], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{y + 1}\\
\mathbf{if}\;y \leq -3.1 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-12}:\\
\;\;\;\;1 + y \cdot x\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+114}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.10000000000000005e-9 or 3.0000000000000001e-12 < y < 1.25e64Initial program 49.3%
associate-/l*65.4%
remove-double-neg65.4%
remove-double-neg65.4%
+-commutative65.4%
Simplified65.4%
Taylor expanded in x around inf 58.6%
associate-/l*74.6%
Simplified74.6%
if -3.10000000000000005e-9 < y < 3.0000000000000001e-12Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
if 1.25e64 < y < 1.8e114Initial program 17.8%
associate-/l*26.1%
remove-double-neg26.1%
remove-double-neg26.1%
+-commutative26.1%
Simplified26.1%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 73.9%
if 1.8e114 < y Initial program 17.2%
associate-/l*29.4%
remove-double-neg29.4%
remove-double-neg29.4%
+-commutative29.4%
Simplified29.4%
Taylor expanded in y around inf 79.0%
Final simplification85.9%
(FPCore (x y) :precision binary64 (if (or (<= y -280000.0) (not (<= y 340000.0))) (+ x (/ (- (- 1.0 x) (/ (- 1.0 x) y)) y)) (+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))))
double code(double x, double y) {
double tmp;
if ((y <= -280000.0) || !(y <= 340000.0)) {
tmp = x + (((1.0 - x) - ((1.0 - x) / y)) / y);
} else {
tmp = 1.0 + ((1.0 - x) * (y / (-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 <= (-280000.0d0)) .or. (.not. (y <= 340000.0d0))) then
tmp = x + (((1.0d0 - x) - ((1.0d0 - x) / y)) / y)
else
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -280000.0) || !(y <= 340000.0)) {
tmp = x + (((1.0 - x) - ((1.0 - x) / y)) / y);
} else {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -280000.0) or not (y <= 340000.0): tmp = x + (((1.0 - x) - ((1.0 - x) / y)) / y) else: tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -280000.0) || !(y <= 340000.0)) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) - Float64(Float64(1.0 - x) / y)) / y)); else tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -280000.0) || ~((y <= 340000.0))) tmp = x + (((1.0 - x) - ((1.0 - x) / y)) / y); else tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -280000.0], N[Not[LessEqual[y, 340000.0]], $MachinePrecision]], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] - N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -280000 \lor \neg \left(y \leq 340000\right):\\
\;\;\;\;x + \frac{\left(1 - x\right) - \frac{1 - x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\end{array}
\end{array}
if y < -2.8e5 or 3.4e5 < y Initial program 33.5%
associate-/l*49.8%
remove-double-neg49.8%
remove-double-neg49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in y around inf 99.9%
Simplified99.9%
if -2.8e5 < y < 3.4e5Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -1.0)
(+ x (/ (- 1.0 x) y))
(if (<= y 1.0)
(+ 1.0 (* (- 1.0 x) (* y (+ y -1.0))))
(+ x (/ (+ 1.0 (/ -1.0 y)) y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = 1.0 + ((1.0 - x) * (y * (y + -1.0)));
} else {
tmp = x + ((1.0 + (-1.0 / y)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x + ((1.0d0 - x) / y)
else if (y <= 1.0d0) then
tmp = 1.0d0 + ((1.0d0 - x) * (y * (y + (-1.0d0))))
else
tmp = x + ((1.0d0 + ((-1.0d0) / y)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = 1.0 + ((1.0 - x) * (y * (y + -1.0)));
} else {
tmp = x + ((1.0 + (-1.0 / y)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x + ((1.0 - x) / y) elif y <= 1.0: tmp = 1.0 + ((1.0 - x) * (y * (y + -1.0))) else: tmp = x + ((1.0 + (-1.0 / y)) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); elseif (y <= 1.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y * Float64(y + -1.0)))); else tmp = Float64(x + Float64(Float64(1.0 + Float64(-1.0 / y)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x + ((1.0 - x) / y); elseif (y <= 1.0) tmp = 1.0 + ((1.0 - x) * (y * (y + -1.0))); else tmp = x + ((1.0 + (-1.0 / y)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \left(y \cdot \left(y + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1 + \frac{-1}{y}}{y}\\
\end{array}
\end{array}
if y < -1Initial program 36.9%
associate-/l*58.7%
remove-double-neg58.7%
remove-double-neg58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in y around inf 99.6%
associate--l+99.6%
div-sub99.6%
Simplified99.6%
if -1 < y < 1Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 98.3%
neg-mul-198.3%
sub-neg98.3%
Simplified98.3%
if 1 < y Initial program 31.8%
associate-/l*41.9%
remove-double-neg41.9%
remove-double-neg41.9%
+-commutative41.9%
Simplified41.9%
Taylor expanded in y around inf 98.7%
Simplified98.8%
Taylor expanded in x around 0 98.5%
Final simplification98.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (/ x y))))
(if (<= y -0.072)
t_0
(if (<= y -7.5e-70) (* y x) (if (<= y 1550000.0) 1.0 t_0)))))
double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -0.072) {
tmp = t_0;
} else if (y <= -7.5e-70) {
tmp = y * x;
} else if (y <= 1550000.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 = x - (x / y)
if (y <= (-0.072d0)) then
tmp = t_0
else if (y <= (-7.5d-70)) then
tmp = y * x
else if (y <= 1550000.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 = x - (x / y);
double tmp;
if (y <= -0.072) {
tmp = t_0;
} else if (y <= -7.5e-70) {
tmp = y * x;
} else if (y <= 1550000.0) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x - (x / y) tmp = 0 if y <= -0.072: tmp = t_0 elif y <= -7.5e-70: tmp = y * x elif y <= 1550000.0: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x - Float64(x / y)) tmp = 0.0 if (y <= -0.072) tmp = t_0; elseif (y <= -7.5e-70) tmp = Float64(y * x); elseif (y <= 1550000.0) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x - (x / y); tmp = 0.0; if (y <= -0.072) tmp = t_0; elseif (y <= -7.5e-70) tmp = y * x; elseif (y <= 1550000.0) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.072], t$95$0, If[LessEqual[y, -7.5e-70], N[(y * x), $MachinePrecision], If[LessEqual[y, 1550000.0], 1.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \frac{x}{y}\\
\mathbf{if}\;y \leq -0.072:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-70}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1550000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.0719999999999999946 or 1.55e6 < y Initial program 34.2%
associate-/l*50.4%
remove-double-neg50.4%
remove-double-neg50.4%
+-commutative50.4%
Simplified50.4%
Taylor expanded in x around inf 56.1%
associate-/l*72.3%
Simplified72.3%
Taylor expanded in y around inf 72.1%
mul-1-neg72.1%
unsub-neg72.1%
Simplified72.1%
if -0.0719999999999999946 < y < -7.49999999999999973e-70Initial program 99.9%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 75.5%
associate-/l*75.6%
Simplified75.6%
Taylor expanded in y around 0 63.1%
if -7.49999999999999973e-70 < y < 1.55e6Initial program 99.7%
associate-/l*99.6%
remove-double-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 76.3%
Final simplification73.5%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (+ x (/ (- 1.0 x) y)) (if (<= y 1.0) (- 1.0 (* y (- 1.0 x))) (+ x (/ (+ 1.0 (/ -1.0 y)) y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = 1.0 - (y * (1.0 - x));
} else {
tmp = x + ((1.0 + (-1.0 / y)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x + ((1.0d0 - x) / y)
else if (y <= 1.0d0) then
tmp = 1.0d0 - (y * (1.0d0 - x))
else
tmp = x + ((1.0d0 + ((-1.0d0) / y)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = 1.0 - (y * (1.0 - x));
} else {
tmp = x + ((1.0 + (-1.0 / y)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x + ((1.0 - x) / y) elif y <= 1.0: tmp = 1.0 - (y * (1.0 - x)) else: tmp = x + ((1.0 + (-1.0 / y)) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); elseif (y <= 1.0) tmp = Float64(1.0 - Float64(y * Float64(1.0 - x))); else tmp = Float64(x + Float64(Float64(1.0 + Float64(-1.0 / y)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x + ((1.0 - x) / y); elseif (y <= 1.0) tmp = 1.0 - (y * (1.0 - x)); else tmp = x + ((1.0 + (-1.0 / y)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - y \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1 + \frac{-1}{y}}{y}\\
\end{array}
\end{array}
if y < -1Initial program 36.9%
associate-/l*58.7%
remove-double-neg58.7%
remove-double-neg58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in y around inf 99.6%
associate--l+99.6%
div-sub99.6%
Simplified99.6%
if -1 < y < 1Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 95.5%
if 1 < y Initial program 31.8%
associate-/l*41.9%
remove-double-neg41.9%
remove-double-neg41.9%
+-commutative41.9%
Simplified41.9%
Taylor expanded in y around inf 98.7%
Simplified98.8%
Taylor expanded in x around 0 98.5%
Final simplification97.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ x (/ (- 1.0 x) y)) (- 1.0 (* y (- 1.0 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 - (y * (1.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 <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 - (y * (1.0d0 - x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 - (y * (1.0 - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 - (y * (1.0 - x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 - Float64(y * Float64(1.0 - x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 - (y * (1.0 - x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot \left(1 - x\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 34.4%
associate-/l*50.5%
remove-double-neg50.5%
remove-double-neg50.5%
+-commutative50.5%
Simplified50.5%
Taylor expanded in y around inf 98.8%
associate--l+98.8%
div-sub98.8%
Simplified98.8%
if -1 < y < 1Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 95.5%
Final simplification97.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.35))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.35)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 1.35d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.35)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.35): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.35)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(y * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.35))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.35]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.35\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1.3500000000000001 < y Initial program 34.4%
associate-/l*50.5%
remove-double-neg50.5%
remove-double-neg50.5%
+-commutative50.5%
Simplified50.5%
Taylor expanded in y around inf 98.8%
associate--l+98.8%
div-sub98.8%
Simplified98.8%
if -1 < y < 1.3500000000000001Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 95.5%
Taylor expanded in x around inf 95.0%
mul-1-neg95.0%
distribute-lft-neg-out95.0%
*-commutative95.0%
Simplified95.0%
Final simplification97.0%
(FPCore (x y) :precision binary64 (if (<= y -0.072) x (if (<= y -2.2e-69) (* y x) (if (<= y 1550000.0) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -0.072) {
tmp = x;
} else if (y <= -2.2e-69) {
tmp = y * x;
} else if (y <= 1550000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-0.072d0)) then
tmp = x
else if (y <= (-2.2d-69)) then
tmp = y * x
else if (y <= 1550000.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -0.072) {
tmp = x;
} else if (y <= -2.2e-69) {
tmp = y * x;
} else if (y <= 1550000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -0.072: tmp = x elif y <= -2.2e-69: tmp = y * x elif y <= 1550000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -0.072) tmp = x; elseif (y <= -2.2e-69) tmp = Float64(y * x); elseif (y <= 1550000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -0.072) tmp = x; elseif (y <= -2.2e-69) tmp = y * x; elseif (y <= 1550000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -0.072], x, If[LessEqual[y, -2.2e-69], N[(y * x), $MachinePrecision], If[LessEqual[y, 1550000.0], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.072:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-69}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1550000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -0.0719999999999999946 or 1.55e6 < y Initial program 34.2%
associate-/l*50.4%
remove-double-neg50.4%
remove-double-neg50.4%
+-commutative50.4%
Simplified50.4%
Taylor expanded in y around inf 71.8%
if -0.0719999999999999946 < y < -2.2e-69Initial program 99.9%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 75.5%
associate-/l*75.6%
Simplified75.6%
Taylor expanded in y around 0 63.1%
if -2.2e-69 < y < 1.55e6Initial program 99.7%
associate-/l*99.6%
remove-double-neg99.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 76.3%
Final simplification73.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1550000.0))) (- x (/ x y)) (+ 1.0 (* y x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1550000.0)) {
tmp = x - (x / y);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 1550000.0d0))) then
tmp = x - (x / y)
else
tmp = 1.0d0 + (y * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1550000.0)) {
tmp = x - (x / y);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1550000.0): tmp = x - (x / y) else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1550000.0)) tmp = Float64(x - Float64(x / y)); else tmp = Float64(1.0 + Float64(y * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1550000.0))) tmp = x - (x / y); else tmp = 1.0 + (y * x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1550000.0]], $MachinePrecision]], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1550000\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1.55e6 < y Initial program 33.7%
associate-/l*50.0%
remove-double-neg50.0%
remove-double-neg50.0%
+-commutative50.0%
Simplified50.0%
Taylor expanded in x around inf 56.5%
associate-/l*72.8%
Simplified72.8%
Taylor expanded in y around inf 72.6%
mul-1-neg72.6%
unsub-neg72.6%
Simplified72.6%
if -1 < y < 1.55e6Initial program 99.7%
associate-/l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 94.0%
Taylor expanded in x around inf 93.7%
mul-1-neg93.7%
distribute-lft-neg-out93.7%
*-commutative93.7%
Simplified93.7%
Final simplification82.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 1550000.0) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1550000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= 1550000.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1550000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 1550000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 1550000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 1550000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 1550000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1550000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1.55e6 < y Initial program 33.7%
associate-/l*50.0%
remove-double-neg50.0%
remove-double-neg50.0%
+-commutative50.0%
Simplified50.0%
Taylor expanded in y around inf 72.3%
if -1 < y < 1.55e6Initial program 99.7%
associate-/l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 70.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 65.6%
associate-/l*74.1%
remove-double-neg74.1%
remove-double-neg74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in y around 0 36.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (/ 1.0 y) (- (/ x y) x))))
(if (< y -3693.8482788297247)
t_0
(if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) t_0))))
double code(double x, double y) {
double t_0 = (1.0 / y) - ((x / y) - x);
double tmp;
if (y < -3693.8482788297247) {
tmp = t_0;
} else if (y < 6799310503.41891) {
tmp = 1.0 - (((1.0 - x) * y) / (y + 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 / y) - ((x / y) - x)
if (y < (-3693.8482788297247d0)) then
tmp = t_0
else if (y < 6799310503.41891d0) then
tmp = 1.0d0 - (((1.0d0 - x) * y) / (y + 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 / y) - ((x / y) - x);
double tmp;
if (y < -3693.8482788297247) {
tmp = t_0;
} else if (y < 6799310503.41891) {
tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 / y) - ((x / y) - x) tmp = 0 if y < -3693.8482788297247: tmp = t_0 elif y < 6799310503.41891: tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 / y) - Float64(Float64(x / y) - x)) tmp = 0.0 if (y < -3693.8482788297247) tmp = t_0; elseif (y < 6799310503.41891) tmp = Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 / y) - ((x / y) - x); tmp = 0.0; if (y < -3693.8482788297247) tmp = t_0; elseif (y < 6799310503.41891) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -3693.8482788297247], t$95$0, If[Less[y, 6799310503.41891], N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{y} - \left(\frac{x}{y} - x\right)\\
\mathbf{if}\;y < -3693.8482788297247:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y < 6799310503.41891:\\
\;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024108
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:alt
(if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))