
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
public static double code(double x, double y) {
return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
def code(x, y): return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
function code(x, y) return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673) end
function tmp = code(x, y) tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673; end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\end{array}
(FPCore (x y) :precision binary64 (- 0.918938533204673 (+ (* y 0.5) (* x (- 1.0 y)))))
double code(double x, double y) {
return 0.918938533204673 - ((y * 0.5) + (x * (1.0 - y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0 - ((y * 0.5d0) + (x * (1.0d0 - y)))
end function
public static double code(double x, double y) {
return 0.918938533204673 - ((y * 0.5) + (x * (1.0 - y)));
}
def code(x, y): return 0.918938533204673 - ((y * 0.5) + (x * (1.0 - y)))
function code(x, y) return Float64(0.918938533204673 - Float64(Float64(y * 0.5) + Float64(x * Float64(1.0 - y)))) end
function tmp = code(x, y) tmp = 0.918938533204673 - ((y * 0.5) + (x * (1.0 - y))); end
code[x_, y_] := N[(0.918938533204673 - N[(N[(y * 0.5), $MachinePrecision] + N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 - \left(y \cdot 0.5 + x \cdot \left(1 - y\right)\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= x -620000.0) (not (<= x 112.0))) (* x (+ y -1.0)) (+ (* x y) (- 0.918938533204673 (* y 0.5)))))
double code(double x, double y) {
double tmp;
if ((x <= -620000.0) || !(x <= 112.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-620000.0d0)) .or. (.not. (x <= 112.0d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = (x * y) + (0.918938533204673d0 - (y * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -620000.0) || !(x <= 112.0)) {
tmp = x * (y + -1.0);
} else {
tmp = (x * y) + (0.918938533204673 - (y * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -620000.0) or not (x <= 112.0): tmp = x * (y + -1.0) else: tmp = (x * y) + (0.918938533204673 - (y * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -620000.0) || !(x <= 112.0)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(x * y) + Float64(0.918938533204673 - Float64(y * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -620000.0) || ~((x <= 112.0))) tmp = x * (y + -1.0); else tmp = (x * y) + (0.918938533204673 - (y * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -620000.0], N[Not[LessEqual[x, 112.0]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -620000 \lor \neg \left(x \leq 112\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + \left(0.918938533204673 - y \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -6.2e5 or 112 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in99.9%
associate-+r+99.9%
associate-+l+99.9%
distribute-rgt-neg-in99.9%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.1%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
mul-1-neg99.0%
unsub-neg99.0%
Simplified99.0%
Taylor expanded in x around 0 99.1%
if -6.2e5 < x < 112Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 98.8%
Final simplification98.9%
(FPCore (x y)
:precision binary64
(if (<= y -3.4e+28)
(* x y)
(if (<= y -11.4)
(* y -0.5)
(if (<= y 1.5)
0.918938533204673
(if (<= y 2.25e+246) (* y -0.5) (* x y))))))
double code(double x, double y) {
double tmp;
if (y <= -3.4e+28) {
tmp = x * y;
} else if (y <= -11.4) {
tmp = y * -0.5;
} else if (y <= 1.5) {
tmp = 0.918938533204673;
} else if (y <= 2.25e+246) {
tmp = y * -0.5;
} else {
tmp = 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 <= (-3.4d+28)) then
tmp = x * y
else if (y <= (-11.4d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.5d0) then
tmp = 0.918938533204673d0
else if (y <= 2.25d+246) then
tmp = y * (-0.5d0)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.4e+28) {
tmp = x * y;
} else if (y <= -11.4) {
tmp = y * -0.5;
} else if (y <= 1.5) {
tmp = 0.918938533204673;
} else if (y <= 2.25e+246) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.4e+28: tmp = x * y elif y <= -11.4: tmp = y * -0.5 elif y <= 1.5: tmp = 0.918938533204673 elif y <= 2.25e+246: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -3.4e+28) tmp = Float64(x * y); elseif (y <= -11.4) tmp = Float64(y * -0.5); elseif (y <= 1.5) tmp = 0.918938533204673; elseif (y <= 2.25e+246) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.4e+28) tmp = x * y; elseif (y <= -11.4) tmp = y * -0.5; elseif (y <= 1.5) tmp = 0.918938533204673; elseif (y <= 2.25e+246) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.4e+28], N[(x * y), $MachinePrecision], If[LessEqual[y, -11.4], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.5], 0.918938533204673, If[LessEqual[y, 2.25e+246], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+28}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -11.4:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.5:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+246}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -3.4e28 or 2.25e246 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 58.3%
if -3.4e28 < y < -11.4000000000000004 or 1.5 < y < 2.25e246Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 95.3%
Taylor expanded in x around 0 61.1%
*-commutative61.1%
Simplified61.1%
if -11.4000000000000004 < y < 1.5Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 55.8%
Taylor expanded in y around 0 54.0%
Final simplification56.8%
(FPCore (x y)
:precision binary64
(if (<= y -1.15e+28)
(* x y)
(if (<= y -222.0)
(* y -0.5)
(if (<= y 1.5)
(- 0.918938533204673 x)
(if (<= y 4e+242) (* y -0.5) (* x y))))))
double code(double x, double y) {
double tmp;
if (y <= -1.15e+28) {
tmp = x * y;
} else if (y <= -222.0) {
tmp = y * -0.5;
} else if (y <= 1.5) {
tmp = 0.918938533204673 - x;
} else if (y <= 4e+242) {
tmp = y * -0.5;
} else {
tmp = 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.15d+28)) then
tmp = x * y
else if (y <= (-222.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.5d0) then
tmp = 0.918938533204673d0 - x
else if (y <= 4d+242) then
tmp = y * (-0.5d0)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.15e+28) {
tmp = x * y;
} else if (y <= -222.0) {
tmp = y * -0.5;
} else if (y <= 1.5) {
tmp = 0.918938533204673 - x;
} else if (y <= 4e+242) {
tmp = y * -0.5;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.15e+28: tmp = x * y elif y <= -222.0: tmp = y * -0.5 elif y <= 1.5: tmp = 0.918938533204673 - x elif y <= 4e+242: tmp = y * -0.5 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -1.15e+28) tmp = Float64(x * y); elseif (y <= -222.0) tmp = Float64(y * -0.5); elseif (y <= 1.5) tmp = Float64(0.918938533204673 - x); elseif (y <= 4e+242) tmp = Float64(y * -0.5); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.15e+28) tmp = x * y; elseif (y <= -222.0) tmp = y * -0.5; elseif (y <= 1.5) tmp = 0.918938533204673 - x; elseif (y <= 4e+242) tmp = y * -0.5; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.15e+28], N[(x * y), $MachinePrecision], If[LessEqual[y, -222.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.5], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 4e+242], N[(y * -0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+28}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -222:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.5:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+242}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -1.14999999999999992e28 or 4.0000000000000002e242 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 58.3%
if -1.14999999999999992e28 < y < -222 or 1.5 < y < 4.0000000000000002e242Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 95.3%
Taylor expanded in x around 0 61.1%
*-commutative61.1%
Simplified61.1%
if -222 < y < 1.5Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.3%
neg-mul-197.3%
sub-neg97.3%
Simplified97.3%
Final simplification79.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.45) (not (<= y 1.0))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.45) || !(y <= 1.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - 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.45d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (x - 0.5d0)
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.45) || !(y <= 1.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.45) or not (y <= 1.0): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.45) || !(y <= 1.0)) tmp = Float64(y * Float64(x - 0.5)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.45) || ~((y <= 1.0))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.45], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.44999999999999996 or 1 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.1%
if -1.44999999999999996 < y < 1Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.9%
neg-mul-197.9%
sub-neg97.9%
Simplified97.9%
Final simplification97.5%
(FPCore (x y) :precision binary64 (if (or (<= x -0.62) (not (<= x 0.85))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.62) || !(x <= 0.85)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-0.62d0)) .or. (.not. (x <= 0.85d0))) then
tmp = x * (y + (-1.0d0))
else
tmp = 0.918938533204673d0 - (y * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -0.62) || !(x <= 0.85)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.62) or not (x <= 0.85): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.62) || !(x <= 0.85)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(0.918938533204673 - Float64(y * 0.5)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -0.62) || ~((x <= 0.85))) tmp = x * (y + -1.0); else tmp = 0.918938533204673 - (y * 0.5); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -0.62], N[Not[LessEqual[x, 0.85]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.62 \lor \neg \left(x \leq 0.85\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.619999999999999996 or 0.849999999999999978 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in99.9%
associate-+r+99.9%
associate-+l+99.9%
distribute-rgt-neg-in99.9%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around -inf 98.6%
Taylor expanded in y around 0 98.5%
+-commutative98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in x around 0 98.6%
if -0.619999999999999996 < x < 0.849999999999999978Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.6%
Final simplification98.6%
(FPCore (x y) :precision binary64 (if (<= y -11.4) (* y -0.5) (if (<= y 1.5) 0.918938533204673 (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -11.4) {
tmp = y * -0.5;
} else if (y <= 1.5) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-11.4d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.5d0) then
tmp = 0.918938533204673d0
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -11.4) {
tmp = y * -0.5;
} else if (y <= 1.5) {
tmp = 0.918938533204673;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -11.4: tmp = y * -0.5 elif y <= 1.5: tmp = 0.918938533204673 else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -11.4) tmp = Float64(y * -0.5); elseif (y <= 1.5) tmp = 0.918938533204673; else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -11.4) tmp = y * -0.5; elseif (y <= 1.5) tmp = 0.918938533204673; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -11.4], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.5], 0.918938533204673, N[(y * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -11.4:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.5:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -11.4000000000000004 or 1.5 < y Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.7%
Taylor expanded in x around 0 51.8%
*-commutative51.8%
Simplified51.8%
if -11.4000000000000004 < y < 1.5Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 55.8%
Taylor expanded in y around 0 54.0%
Final simplification52.9%
(FPCore (x y) :precision binary64 0.918938533204673)
double code(double x, double y) {
return 0.918938533204673;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0
end function
public static double code(double x, double y) {
return 0.918938533204673;
}
def code(x, y): return 0.918938533204673
function code(x, y) return 0.918938533204673 end
function tmp = code(x, y) tmp = 0.918938533204673; end
code[x_, y_] := 0.918938533204673
\begin{array}{l}
\\
0.918938533204673
\end{array}
Initial program 100.0%
associate-+l-100.0%
fma-neg100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
fma-neg100.0%
sub-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 76.6%
Taylor expanded in y around 0 29.1%
Final simplification29.1%
herbie shell --seed 2023185
(FPCore (x y)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))