
(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 12 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 (or (<= y -320000.0) (not (<= y 300000.0)))
(- (+ x t_0) (/ t_0 y))
(fma (/ (+ x -1.0) (+ y 1.0)) y 1.0))))
double code(double x, double y) {
double t_0 = (1.0 - x) / y;
double tmp;
if ((y <= -320000.0) || !(y <= 300000.0)) {
tmp = (x + t_0) - (t_0 / y);
} else {
tmp = fma(((x + -1.0) / (y + 1.0)), y, 1.0);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(1.0 - x) / y) tmp = 0.0 if ((y <= -320000.0) || !(y <= 300000.0)) tmp = Float64(Float64(x + t_0) - Float64(t_0 / y)); else tmp = fma(Float64(Float64(x + -1.0) / Float64(y + 1.0)), y, 1.0); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[y, -320000.0], N[Not[LessEqual[y, 300000.0]], $MachinePrecision]], N[(N[(x + t$95$0), $MachinePrecision] - N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -320000 \lor \neg \left(y \leq 300000\right):\\
\;\;\;\;\left(x + t_0\right) - \frac{t_0}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\
\end{array}
\end{array}
if y < -3.2e5 or 3e5 < y Initial program 35.3%
sub-neg35.3%
distribute-neg-frac35.3%
neg-mul-135.3%
associate-*l/35.1%
metadata-eval35.1%
associate-*l/35.1%
associate-/r/35.1%
metadata-eval35.1%
distribute-neg-frac35.1%
cancel-sign-sub-inv35.1%
associate-/r/35.2%
associate-/r*35.2%
neg-mul-135.2%
associate-/r/35.1%
distribute-rgt-neg-in35.1%
associate-/r/35.2%
distribute-neg-frac35.2%
metadata-eval35.2%
associate-/r/35.1%
Simplified54.6%
Taylor expanded in y around -inf 100.0%
+-commutative100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
unpow2100.0%
associate-/r*100.0%
Simplified100.0%
if -3.2e5 < y < 3e5Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-/l*99.9%
distribute-neg-frac99.9%
associate-/r/100.0%
fma-def100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) y)))
(if (or (<= y -235000.0) (not (<= y 260000.0)))
(- (+ x t_0) (/ t_0 y))
(+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0)))))))
double code(double x, double y) {
double t_0 = (1.0 - x) / y;
double tmp;
if ((y <= -235000.0) || !(y <= 260000.0)) {
tmp = (x + t_0) - (t_0 / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 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 = (1.0d0 - x) / y
if ((y <= (-235000.0d0)) .or. (.not. (y <= 260000.0d0))) then
tmp = (x + t_0) - (t_0 / y)
else
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
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 <= -235000.0) || !(y <= 260000.0)) {
tmp = (x + t_0) - (t_0 / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
def code(x, y): t_0 = (1.0 - x) / y tmp = 0 if (y <= -235000.0) or not (y <= 260000.0): tmp = (x + t_0) - (t_0 / y) else: tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))) return tmp
function code(x, y) t_0 = Float64(Float64(1.0 - x) / y) tmp = 0.0 if ((y <= -235000.0) || !(y <= 260000.0)) tmp = Float64(Float64(x + t_0) - Float64(t_0 / y)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 - x) / y; tmp = 0.0; if ((y <= -235000.0) || ~((y <= 260000.0))) tmp = (x + t_0) - (t_0 / y); else tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[y, -235000.0], N[Not[LessEqual[y, 260000.0]], $MachinePrecision]], N[(N[(x + t$95$0), $MachinePrecision] - N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -235000 \lor \neg \left(y \leq 260000\right):\\
\;\;\;\;\left(x + t_0\right) - \frac{t_0}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -235000 or 2.6e5 < y Initial program 35.3%
sub-neg35.3%
distribute-neg-frac35.3%
neg-mul-135.3%
associate-*l/35.1%
metadata-eval35.1%
associate-*l/35.1%
associate-/r/35.1%
metadata-eval35.1%
distribute-neg-frac35.1%
cancel-sign-sub-inv35.1%
associate-/r/35.2%
associate-/r*35.2%
neg-mul-135.2%
associate-/r/35.1%
distribute-rgt-neg-in35.1%
associate-/r/35.2%
distribute-neg-frac35.2%
metadata-eval35.2%
associate-/r/35.1%
Simplified54.6%
Taylor expanded in y around -inf 100.0%
+-commutative100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
unpow2100.0%
associate-/r*100.0%
Simplified100.0%
if -235000 < y < 2.6e5Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -102000000.0) (not (<= y 130000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -102000000.0) || !(y <= 130000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (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 ((y <= (-102000000.0d0)) .or. (.not. (y <= 130000000.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -102000000.0) || !(y <= 130000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -102000000.0) or not (y <= 130000000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -102000000.0) || !(y <= 130000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -102000000.0) || ~((y <= 130000000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -102000000.0], N[Not[LessEqual[y, 130000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -102000000 \lor \neg \left(y \leq 130000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -1.02e8 or 1.3e8 < y Initial program 35.3%
sub-neg35.3%
distribute-neg-frac35.3%
neg-mul-135.3%
associate-*l/35.1%
metadata-eval35.1%
associate-*l/35.1%
associate-/r/35.1%
metadata-eval35.1%
distribute-neg-frac35.1%
cancel-sign-sub-inv35.1%
associate-/r/35.2%
associate-/r*35.2%
neg-mul-135.2%
associate-/r/35.1%
distribute-rgt-neg-in35.1%
associate-/r/35.2%
distribute-neg-frac35.2%
metadata-eval35.2%
associate-/r/35.1%
Simplified54.6%
Taylor expanded in y around inf 99.4%
+-commutative99.4%
associate--l+99.4%
div-sub99.4%
sub-neg99.4%
+-commutative99.4%
metadata-eval99.4%
distribute-neg-in99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
sub-neg99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
if -1.02e8 < y < 1.3e8Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified100.0%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= y -52000.0) (not (<= y 50000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (/ x (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -52000.0) || !(y <= 50000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * (x / (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 ((y <= (-52000.0d0)) .or. (.not. (y <= 50000.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * (x / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -52000.0) || !(y <= 50000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * (x / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -52000.0) or not (y <= 50000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * (x / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -52000.0) || !(y <= 50000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(y * Float64(x / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -52000.0) || ~((y <= 50000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * (x / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -52000.0], N[Not[LessEqual[y, 50000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -52000 \lor \neg \left(y \leq 50000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if y < -52000 or 5e4 < y Initial program 35.3%
sub-neg35.3%
distribute-neg-frac35.3%
neg-mul-135.3%
associate-*l/35.1%
metadata-eval35.1%
associate-*l/35.1%
associate-/r/35.1%
metadata-eval35.1%
distribute-neg-frac35.1%
cancel-sign-sub-inv35.1%
associate-/r/35.2%
associate-/r*35.2%
neg-mul-135.2%
associate-/r/35.1%
distribute-rgt-neg-in35.1%
associate-/r/35.2%
distribute-neg-frac35.2%
metadata-eval35.2%
associate-/r/35.1%
Simplified54.6%
Taylor expanded in y around inf 99.4%
+-commutative99.4%
associate--l+99.4%
div-sub99.4%
sub-neg99.4%
+-commutative99.4%
metadata-eval99.4%
distribute-neg-in99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
sub-neg99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
if -52000 < y < 5e4Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified100.0%
Taylor expanded in x around inf 96.5%
neg-mul-196.5%
distribute-neg-frac96.5%
Simplified96.5%
Final simplification97.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (/ x y))))
(if (<= y -1.0)
t_0
(if (<= y 4e-91) (- 1.0 y) (if (<= y 0.035) (* y x) t_0)))))
double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= 4e-91) {
tmp = 1.0 - y;
} else if (y <= 0.035) {
tmp = y * x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x - (x / y)
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= 4d-91) then
tmp = 1.0d0 - y
else if (y <= 0.035d0) then
tmp = y * x
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 <= -1.0) {
tmp = t_0;
} else if (y <= 4e-91) {
tmp = 1.0 - y;
} else if (y <= 0.035) {
tmp = y * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x - (x / y) tmp = 0 if y <= -1.0: tmp = t_0 elif y <= 4e-91: tmp = 1.0 - y elif y <= 0.035: tmp = y * x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x - Float64(x / y)) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= 4e-91) tmp = Float64(1.0 - y); elseif (y <= 0.035) tmp = Float64(y * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x - (x / y); tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= 4e-91) tmp = 1.0 - y; elseif (y <= 0.035) tmp = y * x; 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, -1.0], t$95$0, If[LessEqual[y, 4e-91], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 0.035], N[(y * x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \frac{x}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-91}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 0.035:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1 or 0.035000000000000003 < y Initial program 37.8%
sub-neg37.8%
distribute-neg-frac37.8%
neg-mul-137.8%
associate-*l/37.5%
metadata-eval37.5%
associate-*l/37.5%
associate-/r/37.5%
metadata-eval37.5%
distribute-neg-frac37.5%
cancel-sign-sub-inv37.5%
associate-/r/37.7%
associate-/r*37.7%
neg-mul-137.7%
associate-/r/37.5%
distribute-rgt-neg-in37.5%
associate-/r/37.7%
distribute-neg-frac37.7%
metadata-eval37.7%
associate-/r/37.5%
Simplified56.3%
Taylor expanded in x around inf 53.5%
Taylor expanded in y around inf 71.2%
mul-1-neg71.2%
+-commutative71.2%
sub-neg71.2%
Simplified71.2%
if -1 < y < 4.00000000000000009e-91Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 79.0%
Taylor expanded in y around 0 78.0%
neg-mul-178.0%
unsub-neg78.0%
Simplified78.0%
if 4.00000000000000009e-91 < y < 0.035000000000000003Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around inf 64.1%
Taylor expanded in y around 0 64.1%
Final simplification73.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.2))) (- x (/ x y)) (+ 1.0 (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.2)) {
tmp = x - (x / 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.2d0))) then
tmp = x - (x / 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.2)) {
tmp = x - (x / 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.2): tmp = x - (x / y) else: tmp = 1.0 + (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.2)) tmp = Float64(x - Float64(x / 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.2))) tmp = x - (x / 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.2]], $MachinePrecision]], N[(x - N[(x / 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.2\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1.19999999999999996 < y Initial program 37.3%
sub-neg37.3%
distribute-neg-frac37.3%
neg-mul-137.3%
associate-*l/37.1%
metadata-eval37.1%
associate-*l/37.1%
associate-/r/37.1%
metadata-eval37.1%
distribute-neg-frac37.1%
cancel-sign-sub-inv37.1%
associate-/r/37.2%
associate-/r*37.2%
neg-mul-137.2%
associate-/r/37.1%
distribute-rgt-neg-in37.1%
associate-/r/37.2%
distribute-neg-frac37.2%
metadata-eval37.2%
associate-/r/37.1%
Simplified56.0%
Taylor expanded in x around inf 53.9%
Taylor expanded in y around inf 71.8%
mul-1-neg71.8%
+-commutative71.8%
sub-neg71.8%
Simplified71.8%
if -1 < y < 1.19999999999999996Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 97.3%
Final simplification84.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (+ x -1.0)))))
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 * (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.0d0))) then
tmp = x + ((1.0d0 - x) / 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.0)) {
tmp = x + ((1.0 - x) / 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.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * (x + -1.0)) 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(x + -1.0))); 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 * (x + -1.0)); 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[(x + -1.0), $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(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 37.3%
sub-neg37.3%
distribute-neg-frac37.3%
neg-mul-137.3%
associate-*l/37.1%
metadata-eval37.1%
associate-*l/37.1%
associate-/r/37.1%
metadata-eval37.1%
distribute-neg-frac37.1%
cancel-sign-sub-inv37.1%
associate-/r/37.2%
associate-/r*37.2%
neg-mul-137.2%
associate-/r/37.1%
distribute-rgt-neg-in37.1%
associate-/r/37.2%
distribute-neg-frac37.2%
metadata-eval37.2%
associate-/r/37.1%
Simplified56.0%
Taylor expanded in y around inf 97.1%
+-commutative97.1%
associate--l+97.1%
div-sub97.1%
sub-neg97.1%
+-commutative97.1%
metadata-eval97.1%
distribute-neg-in97.1%
distribute-neg-frac97.1%
metadata-eval97.1%
sub-neg97.1%
unsub-neg97.1%
sub-neg97.1%
metadata-eval97.1%
Simplified97.1%
if -1 < y < 1Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 97.3%
Final simplification97.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 8.2e-91) 1.0 (if (<= y 2.55e-18) (* y x) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 8.2e-91) {
tmp = 1.0;
} else if (y <= 2.55e-18) {
tmp = y * x;
} 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 <= 8.2d-91) then
tmp = 1.0d0
else if (y <= 2.55d-18) then
tmp = y * x
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 <= 8.2e-91) {
tmp = 1.0;
} else if (y <= 2.55e-18) {
tmp = y * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 8.2e-91: tmp = 1.0 elif y <= 2.55e-18: tmp = y * x else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 8.2e-91) tmp = 1.0; elseif (y <= 2.55e-18) tmp = Float64(y * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 8.2e-91) tmp = 1.0; elseif (y <= 2.55e-18) tmp = y * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 8.2e-91], 1.0, If[LessEqual[y, 2.55e-18], N[(y * x), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{-18}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 2.54999999999999991e-18 < y Initial program 38.7%
sub-neg38.7%
distribute-neg-frac38.7%
neg-mul-138.7%
associate-*l/38.5%
metadata-eval38.5%
associate-*l/38.5%
associate-/r/38.5%
metadata-eval38.5%
distribute-neg-frac38.5%
cancel-sign-sub-inv38.5%
associate-/r/38.6%
associate-/r*38.6%
neg-mul-138.6%
associate-/r/38.5%
distribute-rgt-neg-in38.5%
associate-/r/38.6%
distribute-neg-frac38.6%
metadata-eval38.6%
associate-/r/38.5%
Simplified57.0%
Taylor expanded in y around inf 69.9%
if -1 < y < 8.20000000000000048e-91Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 77.5%
if 8.20000000000000048e-91 < y < 2.54999999999999991e-18Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around inf 69.4%
Taylor expanded in y around 0 69.4%
Final simplification72.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 8.4e-91) (- 1.0 y) (if (<= y 2.55e-18) (* y x) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 8.4e-91) {
tmp = 1.0 - y;
} else if (y <= 2.55e-18) {
tmp = y * x;
} 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 <= 8.4d-91) then
tmp = 1.0d0 - y
else if (y <= 2.55d-18) then
tmp = y * x
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 <= 8.4e-91) {
tmp = 1.0 - y;
} else if (y <= 2.55e-18) {
tmp = y * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 8.4e-91: tmp = 1.0 - y elif y <= 2.55e-18: tmp = y * x else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 8.4e-91) tmp = Float64(1.0 - y); elseif (y <= 2.55e-18) tmp = Float64(y * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 8.4e-91) tmp = 1.0 - y; elseif (y <= 2.55e-18) tmp = y * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 8.4e-91], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 2.55e-18], N[(y * x), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-91}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{-18}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 2.54999999999999991e-18 < y Initial program 38.7%
sub-neg38.7%
distribute-neg-frac38.7%
neg-mul-138.7%
associate-*l/38.5%
metadata-eval38.5%
associate-*l/38.5%
associate-/r/38.5%
metadata-eval38.5%
distribute-neg-frac38.5%
cancel-sign-sub-inv38.5%
associate-/r/38.6%
associate-/r*38.6%
neg-mul-138.6%
associate-/r/38.5%
distribute-rgt-neg-in38.5%
associate-/r/38.6%
distribute-neg-frac38.6%
metadata-eval38.6%
associate-/r/38.5%
Simplified57.0%
Taylor expanded in y around inf 69.9%
if -1 < y < 8.3999999999999997e-91Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 79.0%
Taylor expanded in y around 0 78.0%
neg-mul-178.0%
unsub-neg78.0%
Simplified78.0%
if 8.3999999999999997e-91 < y < 2.54999999999999991e-18Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around inf 69.4%
Taylor expanded in y around 0 69.4%
Final simplification73.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 24.5))) (- x (/ x y)) (+ 1.0 (* y x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 24.5)) {
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 <= 24.5d0))) 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 <= 24.5)) {
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 <= 24.5): tmp = x - (x / y) else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 24.5)) 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 <= 24.5))) 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, 24.5]], $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 24.5\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if y < -1 or 24.5 < y Initial program 35.8%
sub-neg35.8%
distribute-neg-frac35.8%
neg-mul-135.8%
associate-*l/35.6%
metadata-eval35.6%
associate-*l/35.6%
associate-/r/35.6%
metadata-eval35.6%
distribute-neg-frac35.6%
cancel-sign-sub-inv35.6%
associate-/r/35.7%
associate-/r*35.7%
neg-mul-135.7%
associate-/r/35.6%
distribute-rgt-neg-in35.6%
associate-/r/35.7%
distribute-neg-frac35.7%
metadata-eval35.7%
associate-/r/35.6%
Simplified55.0%
Taylor expanded in x around inf 54.3%
Taylor expanded in y around inf 73.3%
mul-1-neg73.3%
+-commutative73.3%
sub-neg73.3%
Simplified73.3%
if -1 < y < 24.5Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified100.0%
Taylor expanded in y around 0 95.2%
Taylor expanded in x around inf 94.8%
mul-1-neg94.8%
distribute-rgt-neg-out94.8%
Simplified94.8%
Final simplification84.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 24.0) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 24.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 <= 24.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 <= 24.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 24.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 24.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 <= 24.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 24.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 24:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 24 < y Initial program 35.8%
sub-neg35.8%
distribute-neg-frac35.8%
neg-mul-135.8%
associate-*l/35.6%
metadata-eval35.6%
associate-*l/35.6%
associate-/r/35.6%
metadata-eval35.6%
distribute-neg-frac35.6%
cancel-sign-sub-inv35.6%
associate-/r/35.7%
associate-/r*35.7%
neg-mul-135.7%
associate-/r/35.6%
distribute-rgt-neg-in35.6%
associate-/r/35.7%
distribute-neg-frac35.7%
metadata-eval35.7%
associate-/r/35.6%
Simplified55.0%
Taylor expanded in y around inf 72.9%
if -1 < y < 24Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified100.0%
Taylor expanded in y around 0 68.0%
Final simplification70.4%
(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 68.4%
sub-neg68.4%
distribute-neg-frac68.4%
neg-mul-168.4%
associate-*l/68.3%
metadata-eval68.3%
associate-*l/68.3%
associate-/r/68.3%
metadata-eval68.3%
distribute-neg-frac68.3%
cancel-sign-sub-inv68.3%
associate-/r/68.3%
associate-/r*68.3%
neg-mul-168.3%
associate-/r/68.3%
distribute-rgt-neg-in68.3%
associate-/r/68.3%
distribute-neg-frac68.3%
metadata-eval68.3%
associate-/r/68.3%
Simplified77.8%
Taylor expanded in y around 0 36.3%
Final simplification36.3%
(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 2023230
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(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))))