
(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 15 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) (+ 1.0 y))))
(if (<= t_0 0.1)
(+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))
(if (<= t_0 1.0)
(- x (/ (+ (/ (- 1.0 x) y) (+ x -1.0)) y))
(*
x
(+
(/ y (+ 1.0 y))
(/ (+ (- -1.0 y) (* x (/ y x))) (* x (- -1.0 y)))))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else if (t_0 <= 1.0) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * ((y / (1.0 + y)) + (((-1.0 - y) + (x * (y / x))) / (x * (-1.0 - 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) / (1.0d0 + y)
if (t_0 <= 0.1d0) then
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - y)))
else if (t_0 <= 1.0d0) then
tmp = x - ((((1.0d0 - x) / y) + (x + (-1.0d0))) / y)
else
tmp = x * ((y / (1.0d0 + y)) + ((((-1.0d0) - y) + (x * (y / x))) / (x * ((-1.0d0) - y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else if (t_0 <= 1.0) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * ((y / (1.0 + y)) + (((-1.0 - y) + (x * (y / x))) / (x * (-1.0 - y))));
}
return tmp;
}
def code(x, y): t_0 = ((1.0 - x) * y) / (1.0 + y) tmp = 0 if t_0 <= 0.1: tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) elif t_0 <= 1.0: tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y) else: tmp = x * ((y / (1.0 + y)) + (((-1.0 - y) + (x * (y / x))) / (x * (-1.0 - y)))) return tmp
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 0.1) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); elseif (t_0 <= 1.0) tmp = Float64(x - Float64(Float64(Float64(Float64(1.0 - x) / y) + Float64(x + -1.0)) / y)); else tmp = Float64(x * Float64(Float64(y / Float64(1.0 + y)) + Float64(Float64(Float64(-1.0 - y) + Float64(x * Float64(y / x))) / Float64(x * Float64(-1.0 - y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = ((1.0 - x) * y) / (1.0 + y); tmp = 0.0; if (t_0 <= 0.1) tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); elseif (t_0 <= 1.0) tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y); else tmp = x * ((y / (1.0 + y)) + (((-1.0 - y) + (x * (y / x))) / (x * (-1.0 - y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.1], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(x - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] + N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-1.0 - y), $MachinePrecision] + N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
\mathbf{if}\;t\_0 \leq 0.1:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;x - \frac{\frac{1 - x}{y} + \left(x + -1\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{1 + y} + \frac{\left(-1 - y\right) + x \cdot \frac{y}{x}}{x \cdot \left(-1 - y\right)}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.10000000000000001Initial program 89.8%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
if 0.10000000000000001 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1Initial program 4.9%
associate-/l*4.9%
remove-double-neg4.9%
remove-double-neg4.9%
+-commutative4.9%
Simplified4.9%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if 1 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 76.4%
sub-neg76.4%
+-commutative76.4%
*-commutative76.4%
associate-/l*96.7%
distribute-rgt-neg-in96.7%
fma-define96.7%
distribute-frac-neg296.7%
+-commutative96.7%
distribute-neg-in96.7%
metadata-eval96.7%
unsub-neg96.7%
Simplified96.7%
Taylor expanded in x around inf 97.5%
+-commutative97.5%
+-commutative97.5%
associate-+l+97.5%
+-commutative97.5%
mul-1-neg97.5%
distribute-neg-frac297.5%
distribute-rgt-neg-out97.5%
distribute-neg-in97.5%
metadata-eval97.5%
sub-neg97.5%
Simplified97.5%
associate-/r*98.8%
frac-add99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (+ 1.0 y))))
(if (<= t_0 0.1)
(+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))
(if (<= t_0 1.0000000002)
(- x (/ (+ (/ (- 1.0 x) y) (+ x -1.0)) y))
(* x (+ (+ (/ y (+ 1.0 y)) (/ 1.0 x)) (/ (/ y x) (- -1.0 y))))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else if (t_0 <= 1.0000000002) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * (((y / (1.0 + y)) + (1.0 / x)) + ((y / x) / (-1.0 - 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) / (1.0d0 + y)
if (t_0 <= 0.1d0) then
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - y)))
else if (t_0 <= 1.0000000002d0) then
tmp = x - ((((1.0d0 - x) / y) + (x + (-1.0d0))) / y)
else
tmp = x * (((y / (1.0d0 + y)) + (1.0d0 / x)) + ((y / x) / ((-1.0d0) - y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else if (t_0 <= 1.0000000002) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * (((y / (1.0 + y)) + (1.0 / x)) + ((y / x) / (-1.0 - y)));
}
return tmp;
}
def code(x, y): t_0 = ((1.0 - x) * y) / (1.0 + y) tmp = 0 if t_0 <= 0.1: tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) elif t_0 <= 1.0000000002: tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y) else: tmp = x * (((y / (1.0 + y)) + (1.0 / x)) + ((y / x) / (-1.0 - y))) return tmp
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 0.1) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); elseif (t_0 <= 1.0000000002) tmp = Float64(x - Float64(Float64(Float64(Float64(1.0 - x) / y) + Float64(x + -1.0)) / y)); else tmp = Float64(x * Float64(Float64(Float64(y / Float64(1.0 + y)) + Float64(1.0 / x)) + Float64(Float64(y / x) / Float64(-1.0 - y)))); end return tmp end
function tmp_2 = code(x, y) t_0 = ((1.0 - x) * y) / (1.0 + y); tmp = 0.0; if (t_0 <= 0.1) tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); elseif (t_0 <= 1.0000000002) tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y); else tmp = x * (((y / (1.0 + y)) + (1.0 / x)) + ((y / x) / (-1.0 - y))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.1], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0000000002], N[(x - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] + N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(y / x), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
\mathbf{if}\;t\_0 \leq 0.1:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\mathbf{elif}\;t\_0 \leq 1.0000000002:\\
\;\;\;\;x - \frac{\frac{1 - x}{y} + \left(x + -1\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(\frac{y}{1 + y} + \frac{1}{x}\right) + \frac{\frac{y}{x}}{-1 - y}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.10000000000000001Initial program 89.8%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
if 0.10000000000000001 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.0000000002Initial program 5.8%
associate-/l*5.8%
remove-double-neg5.8%
remove-double-neg5.8%
+-commutative5.8%
Simplified5.8%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if 1.0000000002 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 77.8%
sub-neg77.8%
+-commutative77.8%
*-commutative77.8%
associate-/l*98.8%
distribute-rgt-neg-in98.8%
fma-define98.8%
distribute-frac-neg298.8%
+-commutative98.8%
distribute-neg-in98.8%
metadata-eval98.8%
unsub-neg98.8%
Simplified98.8%
Taylor expanded in x around inf 99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
mul-1-neg99.7%
distribute-neg-frac299.7%
distribute-rgt-neg-out99.7%
distribute-neg-in99.7%
metadata-eval99.7%
sub-neg99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
+-commutative99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
associate-/r*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (+ 1.0 y))))
(if (<= t_0 0.1)
(+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))
(if (<= t_0 1.0000000002)
(- x (/ (+ (/ (- 1.0 x) y) (+ x -1.0)) y))
(* x (+ (/ y (+ 1.0 y)) (+ (/ 1.0 x) (/ y (* x (- -1.0 y))))))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else if (t_0 <= 1.0000000002) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * ((y / (1.0 + y)) + ((1.0 / x) + (y / (x * (-1.0 - 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) / (1.0d0 + y)
if (t_0 <= 0.1d0) then
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - y)))
else if (t_0 <= 1.0000000002d0) then
tmp = x - ((((1.0d0 - x) / y) + (x + (-1.0d0))) / y)
else
tmp = x * ((y / (1.0d0 + y)) + ((1.0d0 / x) + (y / (x * ((-1.0d0) - y)))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else if (t_0 <= 1.0000000002) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * ((y / (1.0 + y)) + ((1.0 / x) + (y / (x * (-1.0 - y)))));
}
return tmp;
}
def code(x, y): t_0 = ((1.0 - x) * y) / (1.0 + y) tmp = 0 if t_0 <= 0.1: tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) elif t_0 <= 1.0000000002: tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y) else: tmp = x * ((y / (1.0 + y)) + ((1.0 / x) + (y / (x * (-1.0 - y))))) return tmp
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 0.1) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); elseif (t_0 <= 1.0000000002) tmp = Float64(x - Float64(Float64(Float64(Float64(1.0 - x) / y) + Float64(x + -1.0)) / y)); else tmp = Float64(x * Float64(Float64(y / Float64(1.0 + y)) + Float64(Float64(1.0 / x) + Float64(y / Float64(x * Float64(-1.0 - y)))))); end return tmp end
function tmp_2 = code(x, y) t_0 = ((1.0 - x) * y) / (1.0 + y); tmp = 0.0; if (t_0 <= 0.1) tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); elseif (t_0 <= 1.0000000002) tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y); else tmp = x * ((y / (1.0 + y)) + ((1.0 / x) + (y / (x * (-1.0 - y))))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.1], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0000000002], N[(x - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] + N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] + N[(y / N[(x * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
\mathbf{if}\;t\_0 \leq 0.1:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\mathbf{elif}\;t\_0 \leq 1.0000000002:\\
\;\;\;\;x - \frac{\frac{1 - x}{y} + \left(x + -1\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{1 + y} + \left(\frac{1}{x} + \frac{y}{x \cdot \left(-1 - y\right)}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.10000000000000001Initial program 89.8%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
if 0.10000000000000001 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.0000000002Initial program 5.8%
associate-/l*5.8%
remove-double-neg5.8%
remove-double-neg5.8%
+-commutative5.8%
Simplified5.8%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if 1.0000000002 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 77.8%
sub-neg77.8%
+-commutative77.8%
*-commutative77.8%
associate-/l*98.8%
distribute-rgt-neg-in98.8%
fma-define98.8%
distribute-frac-neg298.8%
+-commutative98.8%
distribute-neg-in98.8%
metadata-eval98.8%
unsub-neg98.8%
Simplified98.8%
Taylor expanded in x around inf 99.7%
+-commutative99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
mul-1-neg99.7%
distribute-neg-frac299.7%
distribute-rgt-neg-out99.7%
distribute-neg-in99.7%
metadata-eval99.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (+ 1.0 y))) (t_1 (/ y (- -1.0 y))))
(if (<= t_0 0.1)
(+ 1.0 (* (- 1.0 x) t_1))
(if (<= t_0 1.0000000002)
(- x (/ (+ (/ (- 1.0 x) y) (+ x -1.0)) y))
(* x (+ (/ y (+ 1.0 y)) (/ (+ 1.0 t_1) x)))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double t_1 = y / (-1.0 - y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * t_1);
} else if (t_0 <= 1.0000000002) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * ((y / (1.0 + y)) + ((1.0 + t_1) / 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) :: t_1
real(8) :: tmp
t_0 = ((1.0d0 - x) * y) / (1.0d0 + y)
t_1 = y / ((-1.0d0) - y)
if (t_0 <= 0.1d0) then
tmp = 1.0d0 + ((1.0d0 - x) * t_1)
else if (t_0 <= 1.0000000002d0) then
tmp = x - ((((1.0d0 - x) / y) + (x + (-1.0d0))) / y)
else
tmp = x * ((y / (1.0d0 + y)) + ((1.0d0 + t_1) / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double t_1 = y / (-1.0 - y);
double tmp;
if (t_0 <= 0.1) {
tmp = 1.0 + ((1.0 - x) * t_1);
} else if (t_0 <= 1.0000000002) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = x * ((y / (1.0 + y)) + ((1.0 + t_1) / x));
}
return tmp;
}
def code(x, y): t_0 = ((1.0 - x) * y) / (1.0 + y) t_1 = y / (-1.0 - y) tmp = 0 if t_0 <= 0.1: tmp = 1.0 + ((1.0 - x) * t_1) elif t_0 <= 1.0000000002: tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y) else: tmp = x * ((y / (1.0 + y)) + ((1.0 + t_1) / x)) return tmp
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) t_1 = Float64(y / Float64(-1.0 - y)) tmp = 0.0 if (t_0 <= 0.1) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * t_1)); elseif (t_0 <= 1.0000000002) tmp = Float64(x - Float64(Float64(Float64(Float64(1.0 - x) / y) + Float64(x + -1.0)) / y)); else tmp = Float64(x * Float64(Float64(y / Float64(1.0 + y)) + Float64(Float64(1.0 + t_1) / x))); end return tmp end
function tmp_2 = code(x, y) t_0 = ((1.0 - x) * y) / (1.0 + y); t_1 = y / (-1.0 - y); tmp = 0.0; if (t_0 <= 0.1) tmp = 1.0 + ((1.0 - x) * t_1); elseif (t_0 <= 1.0000000002) tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y); else tmp = x * ((y / (1.0 + y)) + ((1.0 + t_1) / x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.1], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0000000002], N[(x - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] + N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + t$95$1), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
t_1 := \frac{y}{-1 - y}\\
\mathbf{if}\;t\_0 \leq 0.1:\\
\;\;\;\;1 + \left(1 - x\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 1.0000000002:\\
\;\;\;\;x - \frac{\frac{1 - x}{y} + \left(x + -1\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{1 + y} + \frac{1 + t\_1}{x}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.10000000000000001Initial program 89.8%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
if 0.10000000000000001 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.0000000002Initial program 5.8%
associate-/l*5.8%
remove-double-neg5.8%
remove-double-neg5.8%
+-commutative5.8%
Simplified5.8%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if 1.0000000002 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 77.8%
sub-neg77.8%
+-commutative77.8%
*-commutative77.8%
associate-/l*98.8%
distribute-rgt-neg-in98.8%
fma-define98.8%
distribute-frac-neg298.8%
+-commutative98.8%
distribute-neg-in98.8%
metadata-eval98.8%
unsub-neg98.8%
Simplified98.8%
Taylor expanded in x around -inf 99.7%
associate-*r*99.7%
neg-mul-199.7%
distribute-lft-out99.7%
associate-*r*99.7%
distribute-lft-neg-in99.7%
*-commutative99.7%
neg-mul-199.7%
remove-double-neg99.7%
+-commutative99.7%
mul-1-neg99.7%
sub-neg99.7%
sub-neg99.7%
distribute-frac-neg299.7%
distribute-neg-in99.7%
metadata-eval99.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -4500000.0) (not (<= y 340000.0))) (- x (/ (+ (/ (- 1.0 x) y) (+ x -1.0)) y)) (+ 1.0 (* (* (- 1.0 x) y) (/ 1.0 (- -1.0 y))))))
double code(double x, double y) {
double tmp;
if ((y <= -4500000.0) || !(y <= 340000.0)) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-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 <= (-4500000.0d0)) .or. (.not. (y <= 340000.0d0))) then
tmp = x - ((((1.0d0 - x) / y) + (x + (-1.0d0))) / y)
else
tmp = 1.0d0 + (((1.0d0 - x) * y) * (1.0d0 / ((-1.0d0) - y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -4500000.0) || !(y <= 340000.0)) {
tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y);
} else {
tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -4500000.0) or not (y <= 340000.0): tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y) else: tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - y))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -4500000.0) || !(y <= 340000.0)) tmp = Float64(x - Float64(Float64(Float64(Float64(1.0 - x) / y) + Float64(x + -1.0)) / y)); else tmp = Float64(1.0 + Float64(Float64(Float64(1.0 - x) * y) * Float64(1.0 / Float64(-1.0 - y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -4500000.0) || ~((y <= 340000.0))) tmp = x - ((((1.0 - x) / y) + (x + -1.0)) / y); else tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -4500000.0], N[Not[LessEqual[y, 340000.0]], $MachinePrecision]], N[(x - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] + N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] * N[(1.0 / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4500000 \lor \neg \left(y \leq 340000\right):\\
\;\;\;\;x - \frac{\frac{1 - x}{y} + \left(x + -1\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(1 - x\right) \cdot y\right) \cdot \frac{1}{-1 - y}\\
\end{array}
\end{array}
if y < -4.5e6 or 3.4e5 < y Initial program 27.3%
associate-/l*47.6%
remove-double-neg47.6%
remove-double-neg47.6%
+-commutative47.6%
Simplified47.6%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if -4.5e6 < y < 3.4e5Initial program 99.8%
clear-num99.7%
associate-/r/99.9%
+-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -225000000.0)
(- x (/ (+ x -1.0) y))
(if (<= y 92000000000.0)
(+ 1.0 (* (* (- 1.0 x) y) (/ 1.0 (- -1.0 y))))
(+ x (/ 1.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -225000000.0) {
tmp = x - ((x + -1.0) / y);
} else if (y <= 92000000000.0) {
tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - 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 <= (-225000000.0d0)) then
tmp = x - ((x + (-1.0d0)) / y)
else if (y <= 92000000000.0d0) then
tmp = 1.0d0 + (((1.0d0 - x) * y) * (1.0d0 / ((-1.0d0) - 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 <= -225000000.0) {
tmp = x - ((x + -1.0) / y);
} else if (y <= 92000000000.0) {
tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - y)));
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -225000000.0: tmp = x - ((x + -1.0) / y) elif y <= 92000000000.0: tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - y))) else: tmp = x + (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -225000000.0) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); elseif (y <= 92000000000.0) tmp = Float64(1.0 + Float64(Float64(Float64(1.0 - x) * y) * Float64(1.0 / Float64(-1.0 - y)))); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -225000000.0) tmp = x - ((x + -1.0) / y); elseif (y <= 92000000000.0) tmp = 1.0 + (((1.0 - x) * y) * (1.0 / (-1.0 - y))); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -225000000.0], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 92000000000.0], N[(1.0 + N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] * N[(1.0 / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -225000000:\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{elif}\;y \leq 92000000000:\\
\;\;\;\;1 + \left(\left(1 - x\right) \cdot y\right) \cdot \frac{1}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -2.25e8Initial program 25.8%
associate-/l*47.4%
remove-double-neg47.4%
remove-double-neg47.4%
+-commutative47.4%
Simplified47.4%
Taylor expanded in y around inf 99.6%
associate--l+99.6%
div-sub99.6%
Simplified99.6%
if -2.25e8 < y < 9.2e10Initial program 99.8%
clear-num99.7%
associate-/r/99.9%
+-commutative99.9%
Applied egg-rr99.9%
if 9.2e10 < y Initial program 27.7%
associate-/l*47.0%
remove-double-neg47.0%
remove-double-neg47.0%
+-commutative47.0%
Simplified47.0%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -310000000.0)
(- x (/ (+ x -1.0) y))
(if (<= y 150000000000.0)
(+ 1.0 (* (- 1.0 x) (/ y (- -1.0 y))))
(+ x (/ 1.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -310000000.0) {
tmp = x - ((x + -1.0) / y);
} else if (y <= 150000000000.0) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - 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 <= (-310000000.0d0)) then
tmp = x - ((x + (-1.0d0)) / y)
else if (y <= 150000000000.0d0) then
tmp = 1.0d0 + ((1.0d0 - x) * (y / ((-1.0d0) - 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 <= -310000000.0) {
tmp = x - ((x + -1.0) / y);
} else if (y <= 150000000000.0) {
tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y)));
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -310000000.0: tmp = x - ((x + -1.0) / y) elif y <= 150000000000.0: tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))) else: tmp = x + (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -310000000.0) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); elseif (y <= 150000000000.0) tmp = Float64(1.0 + Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y)))); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -310000000.0) tmp = x - ((x + -1.0) / y); elseif (y <= 150000000000.0) tmp = 1.0 + ((1.0 - x) * (y / (-1.0 - y))); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -310000000.0], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 150000000000.0], N[(1.0 + N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -310000000:\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{elif}\;y \leq 150000000000:\\
\;\;\;\;1 + \left(1 - x\right) \cdot \frac{y}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -3.1e8Initial program 25.8%
associate-/l*47.4%
remove-double-neg47.4%
remove-double-neg47.4%
+-commutative47.4%
Simplified47.4%
Taylor expanded in y around inf 99.6%
associate--l+99.6%
div-sub99.6%
Simplified99.6%
if -3.1e8 < y < 1.5e11Initial program 99.8%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
if 1.5e11 < y Initial program 27.7%
associate-/l*47.0%
remove-double-neg47.0%
remove-double-neg47.0%
+-commutative47.0%
Simplified47.0%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y -5.2e-42) (* x y) (if (<= y 0.385) (- 1.0 y) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= -5.2e-42) {
tmp = x * y;
} else if (y <= 0.385) {
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) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= (-5.2d-42)) then
tmp = x * y
else if (y <= 0.385d0) then
tmp = 1.0d0 - y
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 <= -5.2e-42) {
tmp = x * y;
} else if (y <= 0.385) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= -5.2e-42: tmp = x * y elif y <= 0.385: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= -5.2e-42) tmp = Float64(x * y); elseif (y <= 0.385) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= -5.2e-42) tmp = x * y; elseif (y <= 0.385) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, -5.2e-42], N[(x * y), $MachinePrecision], If[LessEqual[y, 0.385], N[(1.0 - y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{-42}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 0.385:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.38500000000000001 < y Initial program 30.5%
associate-/l*49.9%
remove-double-neg49.9%
remove-double-neg49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around inf 70.0%
if -1 < y < -5.2e-42Initial 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%
Taylor expanded in x around inf 73.5%
*-commutative73.5%
*-lft-identity73.5%
times-frac73.5%
/-rgt-identity73.5%
+-commutative73.5%
Simplified73.5%
Taylor expanded in y around 0 66.5%
*-commutative66.5%
Simplified66.5%
if -5.2e-42 < y < 0.38500000000000001Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 73.2%
+-commutative73.2%
Simplified73.2%
Taylor expanded in y around 0 72.7%
neg-mul-172.7%
unsub-neg72.7%
Simplified72.7%
Final simplification71.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.1))) (- x (/ (+ x -1.0) y)) (+ 1.0 (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.1)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (y * (x + -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 <= (-1.0d0)) .or. (.not. (y <= 1.1d0))) then
tmp = x - ((x + (-1.0d0)) / y)
else
tmp = 1.0d0 + (y * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.1)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.1): tmp = x - ((x + -1.0) / y) else: tmp = 1.0 + (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.1)) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); else tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.1))) tmp = x - ((x + -1.0) / y); else tmp = 1.0 + (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.1]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.1\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1.1000000000000001 < y Initial program 30.0%
associate-/l*49.5%
remove-double-neg49.5%
remove-double-neg49.5%
+-commutative49.5%
Simplified49.5%
Taylor expanded in y around inf 97.6%
associate--l+97.6%
div-sub97.6%
Simplified97.6%
if -1 < y < 1.1000000000000001Initial 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 97.2%
Final simplification97.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.25))) (- x (/ (+ x -1.0) y)) (+ 1.0 (* x y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.25)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (x * 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)) .or. (.not. (y <= 1.25d0))) then
tmp = x - ((x + (-1.0d0)) / y)
else
tmp = 1.0d0 + (x * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.25)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (x * y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.25): tmp = x - ((x + -1.0) / y) else: tmp = 1.0 + (x * y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.25)) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); else tmp = Float64(1.0 + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.25))) tmp = x - ((x + -1.0) / y); else tmp = 1.0 + (x * y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.25]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.25\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot y\\
\end{array}
\end{array}
if y < -1 or 1.25 < y Initial program 30.0%
associate-/l*49.5%
remove-double-neg49.5%
remove-double-neg49.5%
+-commutative49.5%
Simplified49.5%
Taylor expanded in y around inf 97.6%
associate--l+97.6%
div-sub97.6%
Simplified97.6%
if -1 < y < 1.25Initial program 100.0%
clear-num99.9%
associate-/r/100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.2%
neg-mul-198.2%
Simplified98.2%
Taylor expanded in y around 0 96.7%
*-commutative96.7%
Simplified96.7%
Final simplification97.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y -5.2e-42) (* x y) (if (<= y 0.65) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= -5.2e-42) {
tmp = x * y;
} else if (y <= 0.65) {
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 <= (-5.2d-42)) then
tmp = x * y
else if (y <= 0.65d0) 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 <= -5.2e-42) {
tmp = x * y;
} else if (y <= 0.65) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= -5.2e-42: tmp = x * y elif y <= 0.65: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= -5.2e-42) tmp = Float64(x * y); elseif (y <= 0.65) 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 <= -5.2e-42) tmp = x * y; elseif (y <= 0.65) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, -5.2e-42], N[(x * y), $MachinePrecision], If[LessEqual[y, 0.65], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{-42}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 0.65:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.650000000000000022 < y Initial program 30.5%
associate-/l*49.9%
remove-double-neg49.9%
remove-double-neg49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around inf 70.0%
if -1 < y < -5.2e-42Initial 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%
Taylor expanded in x around inf 73.5%
*-commutative73.5%
*-lft-identity73.5%
times-frac73.5%
/-rgt-identity73.5%
+-commutative73.5%
Simplified73.5%
Taylor expanded in y around 0 66.5%
*-commutative66.5%
Simplified66.5%
if -5.2e-42 < y < 0.650000000000000022Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 73.2%
+-commutative73.2%
Simplified73.2%
Taylor expanded in y around 0 72.5%
Final simplification70.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ x (/ 1.0 y)) (+ 1.0 (* x y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x + (1.0 / y);
} else {
tmp = 1.0 + (x * 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)) .or. (.not. (y <= 1.0d0))) then
tmp = x + (1.0d0 / y)
else
tmp = 1.0d0 + (x * y)
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 / y);
} else {
tmp = 1.0 + (x * y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = x + (1.0 / y) else: tmp = 1.0 + (x * y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x + Float64(1.0 / y)); else tmp = Float64(1.0 + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = x + (1.0 / y); else tmp = 1.0 + (x * y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot y\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.5%
associate-/l*49.9%
remove-double-neg49.9%
remove-double-neg49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around inf 97.0%
associate--l+97.0%
div-sub97.0%
Simplified97.0%
Taylor expanded in x around 0 96.1%
if -1 < y < 1Initial program 100.0%
clear-num99.9%
associate-/r/100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.2%
neg-mul-198.2%
Simplified98.2%
Taylor expanded in y around 0 97.3%
*-commutative97.3%
Simplified97.3%
Final simplification96.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 1.06) (+ 1.0 (* x y)) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1.06) {
tmp = 1.0 + (x * y);
} 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 <= 1.06d0) then
tmp = 1.0d0 + (x * y)
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 <= 1.06) {
tmp = 1.0 + (x * y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 1.06: tmp = 1.0 + (x * y) else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 1.06) tmp = Float64(1.0 + Float64(x * y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 1.06) tmp = 1.0 + (x * y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 1.06], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.06:\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1.0600000000000001 < y Initial program 30.5%
associate-/l*49.9%
remove-double-neg49.9%
remove-double-neg49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around inf 70.0%
if -1 < y < 1.0600000000000001Initial program 100.0%
clear-num99.9%
associate-/r/100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 98.2%
neg-mul-198.2%
Simplified98.2%
Taylor expanded in y around 0 97.3%
*-commutative97.3%
Simplified97.3%
Final simplification83.4%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 0.94) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 0.94) {
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 <= 0.94d0) 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 <= 0.94) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 0.94: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 0.94) 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 <= 0.94) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 0.94], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.94:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.93999999999999995 < y Initial program 30.5%
associate-/l*49.9%
remove-double-neg49.9%
remove-double-neg49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in y around inf 70.0%
if -1 < y < 0.93999999999999995Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 69.3%
+-commutative69.3%
Simplified69.3%
Taylor expanded in y around 0 68.0%
(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 64.4%
associate-/l*74.3%
remove-double-neg74.3%
remove-double-neg74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in x around 0 36.6%
+-commutative36.6%
Simplified36.6%
Taylor expanded in y around 0 35.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 2024130
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:alt
(! :herbie-platform default (if (< y -36938482788297247/10000000000000) (- (/ 1 y) (- (/ x y) x)) (if (< y 679931050341891/100000) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x)))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))