
(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 (+ 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.26) (not (<= y 1750000.0))) (- (* x (+ y -1.0)) (* y 0.5)) (- (- 0.918938533204673 (* y 0.5)) x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.26) || !(y <= 1750000.0)) {
tmp = (x * (y + -1.0)) - (y * 0.5);
} 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 ((y <= (-1.26d0)) .or. (.not. (y <= 1750000.0d0))) then
tmp = (x * (y + (-1.0d0))) - (y * 0.5d0)
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 ((y <= -1.26) || !(y <= 1750000.0)) {
tmp = (x * (y + -1.0)) - (y * 0.5);
} else {
tmp = (0.918938533204673 - (y * 0.5)) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.26) or not (y <= 1750000.0): tmp = (x * (y + -1.0)) - (y * 0.5) else: tmp = (0.918938533204673 - (y * 0.5)) - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.26) || !(y <= 1750000.0)) tmp = Float64(Float64(x * Float64(y + -1.0)) - Float64(y * 0.5)); 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 ((y <= -1.26) || ~((y <= 1750000.0))) tmp = (x * (y + -1.0)) - (y * 0.5); else tmp = (0.918938533204673 - (y * 0.5)) - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.26], N[Not[LessEqual[y, 1750000.0]], $MachinePrecision]], N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.26 \lor \neg \left(y \leq 1750000\right):\\
\;\;\;\;x \cdot \left(y + -1\right) - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(0.918938533204673 - y \cdot 0.5\right) - x\\
\end{array}
\end{array}
if y < -1.26000000000000001 or 1.75e6 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
*-commutative54.0%
Simplified100.0%
if -1.26000000000000001 < y < 1.75e6Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.8%
neg-mul-199.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (- x) (* y 0.5))))
(if (<= y -3.2e+34)
t_0
(if (<= y -3.3e-6)
(- (* x y) x)
(if (<= y 1.8) (- 0.918938533204673 x) t_0)))))
double code(double x, double y) {
double t_0 = -x - (y * 0.5);
double tmp;
if (y <= -3.2e+34) {
tmp = t_0;
} else if (y <= -3.3e-6) {
tmp = (x * y) - x;
} else if (y <= 1.8) {
tmp = 0.918938533204673 - 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 - (y * 0.5d0)
if (y <= (-3.2d+34)) then
tmp = t_0
else if (y <= (-3.3d-6)) then
tmp = (x * y) - x
else if (y <= 1.8d0) then
tmp = 0.918938533204673d0 - x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = -x - (y * 0.5);
double tmp;
if (y <= -3.2e+34) {
tmp = t_0;
} else if (y <= -3.3e-6) {
tmp = (x * y) - x;
} else if (y <= 1.8) {
tmp = 0.918938533204673 - x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -x - (y * 0.5) tmp = 0 if y <= -3.2e+34: tmp = t_0 elif y <= -3.3e-6: tmp = (x * y) - x elif y <= 1.8: tmp = 0.918938533204673 - x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(-x) - Float64(y * 0.5)) tmp = 0.0 if (y <= -3.2e+34) tmp = t_0; elseif (y <= -3.3e-6) tmp = Float64(Float64(x * y) - x); elseif (y <= 1.8) tmp = Float64(0.918938533204673 - x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = -x - (y * 0.5); tmp = 0.0; if (y <= -3.2e+34) tmp = t_0; elseif (y <= -3.3e-6) tmp = (x * y) - x; elseif (y <= 1.8) tmp = 0.918938533204673 - x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[((-x) - N[(y * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.2e+34], t$95$0, If[LessEqual[y, -3.3e-6], N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[y, 1.8], N[(0.918938533204673 - x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x\right) - y \cdot 0.5\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{+34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-6}:\\
\;\;\;\;x \cdot y - x\\
\mathbf{elif}\;y \leq 1.8:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -3.1999999999999998e34 or 1.80000000000000004 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 56.6%
neg-mul-156.6%
Simplified56.6%
Taylor expanded in y around inf 56.0%
*-commutative56.0%
Simplified56.0%
if -3.1999999999999998e34 < y < -3.30000000000000017e-6Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if -3.30000000000000017e-6 < y < 1.80000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
unsub-neg98.3%
Simplified98.3%
Final simplification78.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.5) (not (<= y 1.75))) (- (* x y) (* y 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.5) || !(y <= 1.75)) {
tmp = (x * y) - (y * 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.5d0)) .or. (.not. (y <= 1.75d0))) then
tmp = (x * y) - (y * 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.5) || !(y <= 1.75)) {
tmp = (x * y) - (y * 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.5) or not (y <= 1.75): tmp = (x * y) - (y * 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.5) || !(y <= 1.75)) tmp = Float64(Float64(x * y) - Float64(y * 0.5)); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.5) || ~((y <= 1.75))) tmp = (x * y) - (y * 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.5], N[Not[LessEqual[y, 1.75]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \lor \neg \left(y \leq 1.75\right):\\
\;\;\;\;x \cdot y - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.5 or 1.75 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.4%
*-commutative53.8%
Simplified99.4%
Taylor expanded in y around inf 98.1%
if -1.5 < y < 1.75Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
unsub-neg98.3%
Simplified98.3%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= y -3e+34) (not (<= y 360000000.0))) (- (* x y) (* y 0.5)) (- (* x (+ y -1.0)) -0.918938533204673)))
double code(double x, double y) {
double tmp;
if ((y <= -3e+34) || !(y <= 360000000.0)) {
tmp = (x * y) - (y * 0.5);
} else {
tmp = (x * (y + -1.0)) - -0.918938533204673;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-3d+34)) .or. (.not. (y <= 360000000.0d0))) then
tmp = (x * y) - (y * 0.5d0)
else
tmp = (x * (y + (-1.0d0))) - (-0.918938533204673d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -3e+34) || !(y <= 360000000.0)) {
tmp = (x * y) - (y * 0.5);
} else {
tmp = (x * (y + -1.0)) - -0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -3e+34) or not (y <= 360000000.0): tmp = (x * y) - (y * 0.5) else: tmp = (x * (y + -1.0)) - -0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if ((y <= -3e+34) || !(y <= 360000000.0)) tmp = Float64(Float64(x * y) - Float64(y * 0.5)); else tmp = Float64(Float64(x * Float64(y + -1.0)) - -0.918938533204673); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -3e+34) || ~((y <= 360000000.0))) tmp = (x * y) - (y * 0.5); else tmp = (x * (y + -1.0)) - -0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -3e+34], N[Not[LessEqual[y, 360000000.0]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - -0.918938533204673), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+34} \lor \neg \left(y \leq 360000000\right):\\
\;\;\;\;x \cdot y - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right) - -0.918938533204673\\
\end{array}
\end{array}
if y < -3.00000000000000018e34 or 3.6e8 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
*-commutative56.7%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -3.00000000000000018e34 < y < 3.6e8Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 97.8%
Final simplification98.8%
(FPCore (x y)
:precision binary64
(if (<= x -102000000.0)
(- (* x y) x)
(if (<= x 0.5)
(- (- 0.918938533204673 (* y 0.5)) x)
(- (* x (+ y -1.0)) -0.918938533204673))))
double code(double x, double y) {
double tmp;
if (x <= -102000000.0) {
tmp = (x * y) - x;
} else if (x <= 0.5) {
tmp = (0.918938533204673 - (y * 0.5)) - x;
} else {
tmp = (x * (y + -1.0)) - -0.918938533204673;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-102000000.0d0)) then
tmp = (x * y) - x
else if (x <= 0.5d0) then
tmp = (0.918938533204673d0 - (y * 0.5d0)) - x
else
tmp = (x * (y + (-1.0d0))) - (-0.918938533204673d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -102000000.0) {
tmp = (x * y) - x;
} else if (x <= 0.5) {
tmp = (0.918938533204673 - (y * 0.5)) - x;
} else {
tmp = (x * (y + -1.0)) - -0.918938533204673;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -102000000.0: tmp = (x * y) - x elif x <= 0.5: tmp = (0.918938533204673 - (y * 0.5)) - x else: tmp = (x * (y + -1.0)) - -0.918938533204673 return tmp
function code(x, y) tmp = 0.0 if (x <= -102000000.0) tmp = Float64(Float64(x * y) - x); elseif (x <= 0.5) tmp = Float64(Float64(0.918938533204673 - Float64(y * 0.5)) - x); else tmp = Float64(Float64(x * Float64(y + -1.0)) - -0.918938533204673); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -102000000.0) tmp = (x * y) - x; elseif (x <= 0.5) tmp = (0.918938533204673 - (y * 0.5)) - x; else tmp = (x * (y + -1.0)) - -0.918938533204673; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -102000000.0], N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[x, 0.5], N[(N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] - -0.918938533204673), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -102000000:\\
\;\;\;\;x \cdot y - x\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\left(0.918938533204673 - y \cdot 0.5\right) - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y + -1\right) - -0.918938533204673\\
\end{array}
\end{array}
if x < -1.02e8Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around inf 99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-lft-in99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
Simplified99.4%
if -1.02e8 < x < 0.5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.6%
neg-mul-199.6%
Simplified99.6%
if 0.5 < x Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= y -6.2e-5) (not (<= y 0.000106))) (- (* x y) x) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -6.2e-5) || !(y <= 0.000106)) {
tmp = (x * y) - x;
} 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 <= (-6.2d-5)) .or. (.not. (y <= 0.000106d0))) then
tmp = (x * y) - x
else
tmp = 0.918938533204673d0 - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -6.2e-5) || !(y <= 0.000106)) {
tmp = (x * y) - x;
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -6.2e-5) or not (y <= 0.000106): tmp = (x * y) - x else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -6.2e-5) || !(y <= 0.000106)) tmp = Float64(Float64(x * y) - x); else tmp = Float64(0.918938533204673 - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -6.2e-5) || ~((y <= 0.000106))) tmp = (x * y) - x; else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -6.2e-5], N[Not[LessEqual[y, 0.000106]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision], N[(0.918938533204673 - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-5} \lor \neg \left(y \leq 0.000106\right):\\
\;\;\;\;x \cdot y - x\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -6.20000000000000027e-5 or 1.06e-4 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 48.7%
Taylor expanded in x around inf 48.6%
sub-neg48.6%
metadata-eval48.6%
distribute-lft-in48.6%
*-commutative48.6%
mul-1-neg48.6%
unsub-neg48.6%
Simplified48.6%
if -6.20000000000000027e-5 < y < 1.06e-4Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
unsub-neg98.3%
Simplified98.3%
Final simplification74.0%
(FPCore (x y) :precision binary64 (if (<= y -4.4) (* x y) (if (<= y 1.3) 0.918938533204673 (* x y))))
double code(double x, double y) {
double tmp;
if (y <= -4.4) {
tmp = x * y;
} else if (y <= 1.3) {
tmp = 0.918938533204673;
} 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 <= (-4.4d0)) then
tmp = x * y
else if (y <= 1.3d0) then
tmp = 0.918938533204673d0
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.4) {
tmp = x * y;
} else if (y <= 1.3) {
tmp = 0.918938533204673;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.4: tmp = x * y elif y <= 1.3: tmp = 0.918938533204673 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -4.4) tmp = Float64(x * y); elseif (y <= 1.3) tmp = 0.918938533204673; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.4) tmp = x * y; elseif (y <= 1.3) tmp = 0.918938533204673; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.4], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.3], 0.918938533204673, N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.3:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -4.4000000000000004 or 1.30000000000000004 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 48.7%
Taylor expanded in y around inf 47.3%
if -4.4000000000000004 < y < 1.30000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around 0 51.9%
Final simplification49.7%
(FPCore (x y) :precision binary64 (if (<= y -185.0) (* x y) (if (<= y 1.7) (- 0.918938533204673 x) (* x y))))
double code(double x, double y) {
double tmp;
if (y <= -185.0) {
tmp = x * y;
} else if (y <= 1.7) {
tmp = 0.918938533204673 - x;
} 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 <= (-185.0d0)) then
tmp = x * y
else if (y <= 1.7d0) then
tmp = 0.918938533204673d0 - x
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -185.0) {
tmp = x * y;
} else if (y <= 1.7) {
tmp = 0.918938533204673 - x;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -185.0: tmp = x * y elif y <= 1.7: tmp = 0.918938533204673 - x else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -185.0) tmp = Float64(x * y); elseif (y <= 1.7) tmp = Float64(0.918938533204673 - x); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -185.0) tmp = x * y; elseif (y <= 1.7) tmp = 0.918938533204673 - x; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -185.0], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.7], N[(0.918938533204673 - x), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -185:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.7:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -185 or 1.69999999999999996 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 48.7%
Taylor expanded in y around inf 47.3%
if -185 < y < 1.69999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
unsub-neg98.3%
Simplified98.3%
Final simplification73.4%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (- (* x y) -0.918938533204673) (if (<= y 1.5) (- 0.918938533204673 x) (* x y))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = (x * y) - -0.918938533204673;
} else if (y <= 1.5) {
tmp = 0.918938533204673 - x;
} 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.0d0)) then
tmp = (x * y) - (-0.918938533204673d0)
else if (y <= 1.5d0) then
tmp = 0.918938533204673d0 - x
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = (x * y) - -0.918938533204673;
} else if (y <= 1.5) {
tmp = 0.918938533204673 - x;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = (x * y) - -0.918938533204673 elif y <= 1.5: tmp = 0.918938533204673 - x else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(Float64(x * y) - -0.918938533204673); elseif (y <= 1.5) tmp = Float64(0.918938533204673 - x); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = (x * y) - -0.918938533204673; elseif (y <= 1.5) tmp = 0.918938533204673 - x; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(N[(x * y), $MachinePrecision] - -0.918938533204673), $MachinePrecision], If[LessEqual[y, 1.5], N[(0.918938533204673 - x), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x \cdot y - -0.918938533204673\\
\mathbf{elif}\;y \leq 1.5:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if y < -1Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 49.5%
Taylor expanded in y around inf 47.4%
if -1 < y < 1.5Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
unsub-neg98.3%
Simplified98.3%
if 1.5 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 47.9%
Taylor expanded in y around inf 47.7%
Final simplification73.5%
(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%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 74.1%
Taylor expanded in x around 0 27.8%
Final simplification27.8%
herbie shell --seed 2023290
(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))