
(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 11 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 (fma y (+ x -0.5) (- 0.918938533204673 x)))
double code(double x, double y) {
return fma(y, (x + -0.5), (0.918938533204673 - x));
}
function code(x, y) return fma(y, Float64(x + -0.5), Float64(0.918938533204673 - x)) end
code[x_, y_] := N[(y * N[(x + -0.5), $MachinePrecision] + N[(0.918938533204673 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x + -0.5, 0.918938533204673 - x\right)
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
associate-+r+100.0%
associate-+l+100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
metadata-eval100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
*-lft-identity100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= x -440.0) (not (<= x 1.5e+15))) (* x (+ y -1.0)) (- (+ 0.918938533204673 (* y -0.5)) x)))
double code(double x, double y) {
double tmp;
if ((x <= -440.0) || !(x <= 1.5e+15)) {
tmp = x * (y + -1.0);
} else {
tmp = (0.918938533204673 + (y * -0.5)) - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-440.0d0)) .or. (.not. (x <= 1.5d+15))) then
tmp = x * (y + (-1.0d0))
else
tmp = (0.918938533204673d0 + (y * (-0.5d0))) - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -440.0) || !(x <= 1.5e+15)) {
tmp = x * (y + -1.0);
} else {
tmp = (0.918938533204673 + (y * -0.5)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -440.0) or not (x <= 1.5e+15): tmp = x * (y + -1.0) else: tmp = (0.918938533204673 + (y * -0.5)) - x return tmp
function code(x, y) tmp = 0.0 if ((x <= -440.0) || !(x <= 1.5e+15)) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(Float64(0.918938533204673 + Float64(y * -0.5)) - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -440.0) || ~((x <= 1.5e+15))) tmp = x * (y + -1.0); else tmp = (0.918938533204673 + (y * -0.5)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -440.0], N[Not[LessEqual[x, 1.5e+15]], $MachinePrecision]], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -440 \lor \neg \left(x \leq 1.5 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 + y \cdot -0.5\right) - x\\
\end{array}
\end{array}
if x < -440 or 1.5e15 < x 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 x around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
distribute-rgt-in100.0%
fma-def100.0%
neg-mul-1100.0%
fma-neg100.0%
Simplified100.0%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 98.7%
mul-1-neg98.7%
neg-mul-198.7%
sub-neg98.7%
neg-sub098.7%
sub-neg98.7%
+-commutative98.7%
distribute-rgt1-in98.7%
distribute-lft-neg-in98.7%
unsub-neg98.7%
associate-+l-98.7%
*-rgt-identity98.7%
neg-sub098.7%
*-rgt-identity98.7%
mul-1-neg98.7%
distribute-rgt-in98.7%
+-commutative98.7%
Simplified98.7%
if -440 < x < 1.5e15Initial 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 99.5%
neg-mul-199.5%
Simplified99.5%
Taylor expanded in y around 0 99.5%
Final simplification99.1%
(FPCore (x y) :precision binary64 (+ 0.918938533204673 (- (* x (+ y -1.0)) (* y 0.5))))
double code(double x, double y) {
return 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.918938533204673d0 + ((x * (y + (-1.0d0))) - (y * 0.5d0))
end function
public static double code(double x, double y) {
return 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5));
}
def code(x, y): return 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5))
function code(x, y) return Float64(0.918938533204673 + Float64(Float64(x * Float64(y + -1.0)) - Float64(y * 0.5))) end
function tmp = code(x, y) tmp = 0.918938533204673 + ((x * (y + -1.0)) - (y * 0.5)); end
code[x_, y_] := N[(0.918938533204673 + N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.918938533204673 + \left(x \cdot \left(y + -1\right) - y \cdot 0.5\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.25) (not (<= y 1.0))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.25) || !(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.25d0)) .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.25) || !(y <= 1.0)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.25) 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.25) || !(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.25) || ~((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.25], 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.25 \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.25 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 96.4%
if -1.25 < 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 98.3%
neg-mul-198.3%
unsub-neg98.3%
Simplified98.3%
Final simplification97.3%
(FPCore (x y) :precision binary64 (if (or (<= x -0.72) (not (<= x 0.62))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.72) || !(x <= 0.62)) {
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.72d0)) .or. (.not. (x <= 0.62d0))) 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.72) || !(x <= 0.62)) {
tmp = x * (y + -1.0);
} else {
tmp = 0.918938533204673 - (y * 0.5);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -0.72) or not (x <= 0.62): tmp = x * (y + -1.0) else: tmp = 0.918938533204673 - (y * 0.5) return tmp
function code(x, y) tmp = 0.0 if ((x <= -0.72) || !(x <= 0.62)) 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.72) || ~((x <= 0.62))) 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.72], N[Not[LessEqual[x, 0.62]], $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.72 \lor \neg \left(x \leq 0.62\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\end{array}
\end{array}
if x < -0.71999999999999997 or 0.619999999999999996 < x 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 x around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
distribute-rgt-in100.0%
fma-def100.0%
neg-mul-1100.0%
fma-neg100.0%
Simplified100.0%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
neg-mul-196.4%
sub-neg96.4%
neg-sub096.4%
sub-neg96.4%
+-commutative96.4%
distribute-rgt1-in96.4%
distribute-lft-neg-in96.4%
unsub-neg96.4%
associate-+l-96.4%
*-rgt-identity96.4%
neg-sub096.4%
*-rgt-identity96.4%
mul-1-neg96.4%
distribute-rgt-in96.4%
+-commutative96.4%
Simplified96.4%
if -0.71999999999999997 < x < 0.619999999999999996Initial 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.5%
Final simplification97.4%
(FPCore (x y) :precision binary64 (- (+ 0.918938533204673 (* y (- x 0.5))) x))
double code(double x, double y) {
return (0.918938533204673 + (y * (x - 0.5))) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.918938533204673d0 + (y * (x - 0.5d0))) - x
end function
public static double code(double x, double y) {
return (0.918938533204673 + (y * (x - 0.5))) - x;
}
def code(x, y): return (0.918938533204673 + (y * (x - 0.5))) - x
function code(x, y) return Float64(Float64(0.918938533204673 + Float64(y * Float64(x - 0.5))) - x) end
function tmp = code(x, y) tmp = (0.918938533204673 + (y * (x - 0.5))) - x; end
code[x_, y_] := N[(N[(0.918938533204673 + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x
\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 x around 0 100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
distribute-rgt-in100.0%
fma-def100.0%
neg-mul-1100.0%
fma-neg100.0%
Simplified100.0%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= x -0.7) (- x) (if (<= x 0.5) (* y -0.5) (- x))))
double code(double x, double y) {
double tmp;
if (x <= -0.7) {
tmp = -x;
} else if (x <= 0.5) {
tmp = y * -0.5;
} 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 (x <= (-0.7d0)) then
tmp = -x
else if (x <= 0.5d0) then
tmp = y * (-0.5d0)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.7) {
tmp = -x;
} else if (x <= 0.5) {
tmp = y * -0.5;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.7: tmp = -x elif x <= 0.5: tmp = y * -0.5 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.7) tmp = Float64(-x); elseif (x <= 0.5) tmp = Float64(y * -0.5); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.7) tmp = -x; elseif (x <= 0.5) tmp = y * -0.5; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.7], (-x), If[LessEqual[x, 0.5], N[(y * -0.5), $MachinePrecision], (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.7:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -0.69999999999999996 or 0.5 < x 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 0 50.6%
neg-mul-150.6%
Simplified50.6%
Taylor expanded in y around 0 50.6%
Taylor expanded in x around inf 48.0%
mul-1-neg48.0%
Simplified48.0%
if -0.69999999999999996 < x < 0.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 48.5%
Taylor expanded in x around 0 47.9%
*-commutative47.9%
Simplified47.9%
Final simplification47.9%
(FPCore (x y) :precision binary64 (if (<= y -12600.0) (* y x) (if (<= y 1.25) (- x) (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -12600.0) {
tmp = y * x;
} else if (y <= 1.25) {
tmp = -x;
} 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 <= (-12600.0d0)) then
tmp = y * x
else if (y <= 1.25d0) then
tmp = -x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -12600.0) {
tmp = y * x;
} else if (y <= 1.25) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -12600.0: tmp = y * x elif y <= 1.25: tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -12600.0) tmp = Float64(y * x); elseif (y <= 1.25) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -12600.0) tmp = y * x; elseif (y <= 1.25) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -12600.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.25], (-x), N[(y * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -12600:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.25:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -12600Initial 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 100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
distribute-rgt-in99.9%
fma-def100.0%
neg-mul-1100.0%
fma-neg99.9%
Simplified99.9%
Taylor expanded in y around -inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 57.6%
mul-1-neg57.6%
neg-mul-157.6%
sub-neg57.6%
neg-sub057.6%
sub-neg57.6%
+-commutative57.6%
distribute-rgt1-in57.6%
distribute-lft-neg-in57.6%
unsub-neg57.6%
associate-+l-57.6%
*-rgt-identity57.6%
neg-sub057.6%
*-rgt-identity57.6%
mul-1-neg57.6%
distribute-rgt-in57.6%
+-commutative57.6%
Simplified57.6%
Taylor expanded in y around inf 56.1%
if -12600 < y < 1.25Initial 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 99.4%
neg-mul-199.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around inf 48.6%
mul-1-neg48.6%
Simplified48.6%
if 1.25 < 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%
Taylor expanded in x around 0 50.1%
*-commutative50.1%
Simplified50.1%
Final simplification51.1%
(FPCore (x y) :precision binary64 (if (<= y -58000.0) (* y x) (if (<= y 1.85) (- 0.918938533204673 x) (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -58000.0) {
tmp = y * x;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} 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 <= (-58000.0d0)) then
tmp = y * x
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -58000.0) {
tmp = y * x;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -58000.0: tmp = y * x elif y <= 1.85: tmp = 0.918938533204673 - x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -58000.0) tmp = Float64(y * x); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -58000.0) tmp = y * x; elseif (y <= 1.85) tmp = 0.918938533204673 - x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -58000.0], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -58000:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -58000Initial 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 100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
distribute-rgt-in99.9%
fma-def100.0%
neg-mul-1100.0%
fma-neg99.9%
Simplified99.9%
Taylor expanded in y around -inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 58.3%
mul-1-neg58.3%
neg-mul-158.3%
sub-neg58.3%
neg-sub058.3%
sub-neg58.3%
+-commutative58.3%
distribute-rgt1-in58.3%
distribute-lft-neg-in58.3%
unsub-neg58.3%
associate-+l-58.3%
*-rgt-identity58.3%
neg-sub058.3%
*-rgt-identity58.3%
mul-1-neg58.3%
distribute-rgt-in58.3%
+-commutative58.3%
Simplified58.3%
Taylor expanded in y around inf 56.8%
if -58000 < y < 1.8500000000000001Initial 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.0%
neg-mul-197.0%
unsub-neg97.0%
Simplified97.0%
if 1.8500000000000001 < 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%
Taylor expanded in x around 0 50.1%
*-commutative50.1%
Simplified50.1%
Final simplification75.8%
(FPCore (x y) :precision binary64 (if (<= y -6.9e-9) (* x (+ y -1.0)) (if (<= y 1.85) (- 0.918938533204673 x) (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -6.9e-9) {
tmp = x * (y + -1.0);
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} 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 <= (-6.9d-9)) then
tmp = x * (y + (-1.0d0))
else if (y <= 1.85d0) then
tmp = 0.918938533204673d0 - x
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -6.9e-9) {
tmp = x * (y + -1.0);
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6.9e-9: tmp = x * (y + -1.0) elif y <= 1.85: tmp = 0.918938533204673 - x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -6.9e-9) tmp = Float64(x * Float64(y + -1.0)); elseif (y <= 1.85) tmp = Float64(0.918938533204673 - x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6.9e-9) tmp = x * (y + -1.0); elseif (y <= 1.85) tmp = 0.918938533204673 - x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6.9e-9], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85], N[(0.918938533204673 - x), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.9 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -6.89999999999999975e-9Initial 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 100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
distribute-rgt-in99.9%
fma-def100.0%
neg-mul-1100.0%
fma-neg99.9%
Simplified99.9%
Taylor expanded in y around -inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 56.8%
mul-1-neg56.8%
neg-mul-156.8%
sub-neg56.8%
neg-sub056.8%
sub-neg56.8%
+-commutative56.8%
distribute-rgt1-in56.8%
distribute-lft-neg-in56.8%
unsub-neg56.8%
associate-+l-56.8%
*-rgt-identity56.8%
neg-sub056.8%
*-rgt-identity56.8%
mul-1-neg56.8%
distribute-rgt-in56.8%
+-commutative56.8%
Simplified56.8%
if -6.89999999999999975e-9 < y < 1.8500000000000001Initial 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 99.2%
neg-mul-199.2%
unsub-neg99.2%
Simplified99.2%
if 1.8500000000000001 < 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%
Taylor expanded in x around 0 50.1%
*-commutative50.1%
Simplified50.1%
Final simplification76.3%
(FPCore (x y) :precision binary64 (- x))
double code(double x, double y) {
return -x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -x
end function
public static double code(double x, double y) {
return -x;
}
def code(x, y): return -x
function code(x, y) return Float64(-x) end
function tmp = code(x, y) tmp = -x; end
code[x_, y_] := (-x)
\begin{array}{l}
\\
-x
\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 0 74.3%
neg-mul-174.3%
Simplified74.3%
Taylor expanded in y around 0 74.3%
Taylor expanded in x around inf 26.4%
mul-1-neg26.4%
Simplified26.4%
Final simplification26.4%
herbie shell --seed 2023171
(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))