
(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 9 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 (- x 0.5))))
double code(double x, double y) {
return (0.918938533204673 - x) + (y * (x - 0.5));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.918938533204673d0 - x) + (y * (x - 0.5d0))
end function
public static double code(double x, double y) {
return (0.918938533204673 - x) + (y * (x - 0.5));
}
def code(x, y): return (0.918938533204673 - x) + (y * (x - 0.5))
function code(x, y) return Float64(Float64(0.918938533204673 - x) + Float64(y * Float64(x - 0.5))) end
function tmp = code(x, y) tmp = (0.918938533204673 - x) + (y * (x - 0.5)); end
code[x_, y_] := N[(N[(0.918938533204673 - x), $MachinePrecision] + N[(y * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.918938533204673 - x\right) + y \cdot \left(x - 0.5\right)
\end{array}
Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around -inf 100.0%
neg-mul-1100.0%
associate-+r+100.0%
sub-neg100.0%
mul-1-neg100.0%
unsub-neg100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -1.75e-8)
(* y -0.5)
(if (<= y -1.58e-286)
0.918938533204673
(if (<= y 8e-277)
(- x)
(if (<= y 1.2e-159)
0.918938533204673
(if (<= y 1.85) (- x) (* y -0.5)))))))
double code(double x, double y) {
double tmp;
if (y <= -1.75e-8) {
tmp = y * -0.5;
} else if (y <= -1.58e-286) {
tmp = 0.918938533204673;
} else if (y <= 8e-277) {
tmp = -x;
} else if (y <= 1.2e-159) {
tmp = 0.918938533204673;
} else if (y <= 1.85) {
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 <= (-1.75d-8)) then
tmp = y * (-0.5d0)
else if (y <= (-1.58d-286)) then
tmp = 0.918938533204673d0
else if (y <= 8d-277) then
tmp = -x
else if (y <= 1.2d-159) then
tmp = 0.918938533204673d0
else if (y <= 1.85d0) 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 <= -1.75e-8) {
tmp = y * -0.5;
} else if (y <= -1.58e-286) {
tmp = 0.918938533204673;
} else if (y <= 8e-277) {
tmp = -x;
} else if (y <= 1.2e-159) {
tmp = 0.918938533204673;
} else if (y <= 1.85) {
tmp = -x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.75e-8: tmp = y * -0.5 elif y <= -1.58e-286: tmp = 0.918938533204673 elif y <= 8e-277: tmp = -x elif y <= 1.2e-159: tmp = 0.918938533204673 elif y <= 1.85: tmp = -x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -1.75e-8) tmp = Float64(y * -0.5); elseif (y <= -1.58e-286) tmp = 0.918938533204673; elseif (y <= 8e-277) tmp = Float64(-x); elseif (y <= 1.2e-159) tmp = 0.918938533204673; elseif (y <= 1.85) tmp = Float64(-x); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.75e-8) tmp = y * -0.5; elseif (y <= -1.58e-286) tmp = 0.918938533204673; elseif (y <= 8e-277) tmp = -x; elseif (y <= 1.2e-159) tmp = 0.918938533204673; elseif (y <= 1.85) tmp = -x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.75e-8], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.58e-286], 0.918938533204673, If[LessEqual[y, 8e-277], (-x), If[LessEqual[y, 1.2e-159], 0.918938533204673, If[LessEqual[y, 1.85], (-x), N[(y * -0.5), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{-8}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.58 \cdot 10^{-286}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-277}:\\
\;\;\;\;-x\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-159}:\\
\;\;\;\;0.918938533204673\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -1.75000000000000012e-8 or 1.8500000000000001 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 96.9%
Taylor expanded in x around 0 54.0%
*-commutative54.0%
Simplified54.0%
if -1.75000000000000012e-8 < y < -1.57999999999999989e-286 or 7.99999999999999975e-277 < y < 1.19999999999999999e-159Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 68.2%
Taylor expanded in y around 0 67.4%
if -1.57999999999999989e-286 < y < 7.99999999999999975e-277 or 1.19999999999999999e-159 < y < 1.8500000000000001Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
associate-+r+100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 63.9%
mul-1-neg63.9%
*-commutative63.9%
distribute-rgt-neg-in63.9%
mul-1-neg63.9%
unsub-neg63.9%
Simplified63.9%
Taylor expanded in y around 0 60.8%
mul-1-neg60.8%
Simplified60.8%
Final simplification59.2%
(FPCore (x y)
:precision binary64
(if (<= y -17.0)
(* y -0.5)
(if (<= y 1.06e-19)
(- 0.918938533204673 x)
(if (<= y 1250000000000.0) (* x (+ y -1.0)) (* y -0.5)))))
double code(double x, double y) {
double tmp;
if (y <= -17.0) {
tmp = y * -0.5;
} else if (y <= 1.06e-19) {
tmp = 0.918938533204673 - x;
} else if (y <= 1250000000000.0) {
tmp = x * (y + -1.0);
} 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 <= (-17.0d0)) then
tmp = y * (-0.5d0)
else if (y <= 1.06d-19) then
tmp = 0.918938533204673d0 - x
else if (y <= 1250000000000.0d0) then
tmp = x * (y + (-1.0d0))
else
tmp = y * (-0.5d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -17.0) {
tmp = y * -0.5;
} else if (y <= 1.06e-19) {
tmp = 0.918938533204673 - x;
} else if (y <= 1250000000000.0) {
tmp = x * (y + -1.0);
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -17.0: tmp = y * -0.5 elif y <= 1.06e-19: tmp = 0.918938533204673 - x elif y <= 1250000000000.0: tmp = x * (y + -1.0) else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -17.0) tmp = Float64(y * -0.5); elseif (y <= 1.06e-19) tmp = Float64(0.918938533204673 - x); elseif (y <= 1250000000000.0) tmp = Float64(x * Float64(y + -1.0)); else tmp = Float64(y * -0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -17.0) tmp = y * -0.5; elseif (y <= 1.06e-19) tmp = 0.918938533204673 - x; elseif (y <= 1250000000000.0) tmp = x * (y + -1.0); else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -17.0], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.06e-19], N[(0.918938533204673 - x), $MachinePrecision], If[LessEqual[y, 1250000000000.0], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], N[(y * -0.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -17:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-19}:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{elif}\;y \leq 1250000000000:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -17 or 1.25e12 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 99.3%
Taylor expanded in x around 0 55.8%
*-commutative55.8%
Simplified55.8%
if -17 < y < 1.06e-19Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.1%
neg-mul-199.1%
sub-neg99.1%
Simplified99.1%
if 1.06e-19 < y < 1.25e12Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
distribute-lft-out--99.6%
cancel-sign-sub-inv99.6%
*-rgt-identity99.6%
associate-+r+99.6%
associate-+l+99.6%
+-commutative99.6%
unsub-neg99.6%
associate-+r-99.6%
*-commutative99.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
distribute-lft-out99.6%
fma-def99.6%
+-commutative99.6%
sub-neg99.6%
Simplified99.6%
Taylor expanded in x around -inf 86.5%
mul-1-neg86.5%
*-commutative86.5%
distribute-rgt-neg-in86.5%
mul-1-neg86.5%
unsub-neg86.5%
Simplified86.5%
Taylor expanded in y around 0 86.3%
Taylor expanded in x around 0 86.5%
Final simplification77.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.3) (not (<= y 1.2))) (* y (- x 0.5)) (- 0.918938533204673 x)))
double code(double x, double y) {
double tmp;
if ((y <= -1.3) || !(y <= 1.2)) {
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.3d0)) .or. (.not. (y <= 1.2d0))) 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.3) || !(y <= 1.2)) {
tmp = y * (x - 0.5);
} else {
tmp = 0.918938533204673 - x;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.3) or not (y <= 1.2): tmp = y * (x - 0.5) else: tmp = 0.918938533204673 - x return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.3) || !(y <= 1.2)) 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.3) || ~((y <= 1.2))) tmp = y * (x - 0.5); else tmp = 0.918938533204673 - x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.3], N[Not[LessEqual[y, 1.2]], $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.3 \lor \neg \left(y \leq 1.2\right):\\
\;\;\;\;y \cdot \left(x - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.918938533204673 - x\\
\end{array}
\end{array}
if y < -1.30000000000000004 or 1.19999999999999996 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.6%
if -1.30000000000000004 < y < 1.19999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.0%
neg-mul-198.0%
sub-neg98.0%
Simplified98.0%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (or (<= x -0.72) (not (<= x 0.7))) (* x (+ y -1.0)) (- 0.918938533204673 (* y 0.5))))
double code(double x, double y) {
double tmp;
if ((x <= -0.72) || !(x <= 0.7)) {
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.7d0))) 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.7)) {
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.7): 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.7)) 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.7))) 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.7]], $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.7\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.69999999999999996 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
associate-+r+100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
mul-1-neg98.4%
unsub-neg98.4%
Simplified98.4%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around 0 98.4%
if -0.71999999999999997 < x < 0.69999999999999996Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (<= x -0.68) (* x (+ y -1.0)) (if (<= x 0.9) (- 0.918938533204673 (* y 0.5)) (- (* x y) x))))
double code(double x, double y) {
double tmp;
if (x <= -0.68) {
tmp = x * (y + -1.0);
} else if (x <= 0.9) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = (x * y) - 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.68d0)) then
tmp = x * (y + (-1.0d0))
else if (x <= 0.9d0) then
tmp = 0.918938533204673d0 - (y * 0.5d0)
else
tmp = (x * y) - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.68) {
tmp = x * (y + -1.0);
} else if (x <= 0.9) {
tmp = 0.918938533204673 - (y * 0.5);
} else {
tmp = (x * y) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.68: tmp = x * (y + -1.0) elif x <= 0.9: tmp = 0.918938533204673 - (y * 0.5) else: tmp = (x * y) - x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.68) tmp = Float64(x * Float64(y + -1.0)); elseif (x <= 0.9) tmp = Float64(0.918938533204673 - Float64(y * 0.5)); else tmp = Float64(Float64(x * y) - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.68) tmp = x * (y + -1.0); elseif (x <= 0.9) tmp = 0.918938533204673 - (y * 0.5); else tmp = (x * y) - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.68], N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.9], N[(0.918938533204673 - N[(y * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.68:\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{elif}\;x \leq 0.9:\\
\;\;\;\;0.918938533204673 - y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot y - x\\
\end{array}
\end{array}
if x < -0.680000000000000049Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
associate-+r+100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 98.7%
mul-1-neg98.7%
*-commutative98.7%
distribute-rgt-neg-in98.7%
mul-1-neg98.7%
unsub-neg98.7%
Simplified98.7%
Taylor expanded in y around 0 98.7%
Taylor expanded in x around 0 98.7%
if -0.680000000000000049 < x < 0.900000000000000022Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
if 0.900000000000000022 < x Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
associate-+r+100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-rgt-neg-in98.2%
mul-1-neg98.2%
unsub-neg98.2%
Simplified98.2%
Taylor expanded in y around 0 98.2%
Taylor expanded in x around 0 98.2%
sub-neg98.2%
metadata-eval98.2%
distribute-lft-in98.2%
*-commutative98.2%
mul-1-neg98.2%
sub-neg98.2%
Simplified98.2%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (<= y -56.0) (* y -0.5) (if (<= y 1.85) (- 0.918938533204673 x) (* y -0.5))))
double code(double x, double y) {
double tmp;
if (y <= -56.0) {
tmp = y * -0.5;
} 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 <= (-56.0d0)) then
tmp = y * (-0.5d0)
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 <= -56.0) {
tmp = y * -0.5;
} else if (y <= 1.85) {
tmp = 0.918938533204673 - x;
} else {
tmp = y * -0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -56.0: tmp = y * -0.5 elif y <= 1.85: tmp = 0.918938533204673 - x else: tmp = y * -0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= -56.0) tmp = Float64(y * -0.5); 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 <= -56.0) tmp = y * -0.5; elseif (y <= 1.85) tmp = 0.918938533204673 - x; else tmp = y * -0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -56.0], N[(y * -0.5), $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 -56:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.85:\\
\;\;\;\;0.918938533204673 - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.5\\
\end{array}
\end{array}
if y < -56 or 1.8500000000000001 < y Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 97.6%
Taylor expanded in x around 0 54.4%
*-commutative54.4%
Simplified54.4%
if -56 < y < 1.8500000000000001Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 98.0%
neg-mul-198.0%
sub-neg98.0%
Simplified98.0%
Final simplification75.5%
(FPCore (x y) :precision binary64 (if (<= x -0.92) (- x) (if (<= x 0.92) 0.918938533204673 (- x))))
double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} 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.92d0)) then
tmp = -x
else if (x <= 0.92d0) then
tmp = 0.918938533204673d0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.92) {
tmp = -x;
} else if (x <= 0.92) {
tmp = 0.918938533204673;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.92: tmp = -x elif x <= 0.92: tmp = 0.918938533204673 else: tmp = -x return tmp
function code(x, y) tmp = 0.0 if (x <= -0.92) tmp = Float64(-x); elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.92) tmp = -x; elseif (x <= 0.92) tmp = 0.918938533204673; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.92], (-x), If[LessEqual[x, 0.92], 0.918938533204673, (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.92:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;0.918938533204673\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if x < -0.92000000000000004 or 0.92000000000000004 < x Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
distribute-lft-out--100.0%
cancel-sign-sub-inv100.0%
*-rgt-identity100.0%
associate-+r+100.0%
associate-+l+100.0%
+-commutative100.0%
unsub-neg100.0%
associate-+r-100.0%
*-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out100.0%
fma-def100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around -inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
mul-1-neg98.4%
unsub-neg98.4%
Simplified98.4%
Taylor expanded in y around 0 47.2%
mul-1-neg47.2%
Simplified47.2%
if -0.92000000000000004 < x < 0.92000000000000004Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
Taylor expanded in y around 0 49.8%
Final simplification48.6%
(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 x around 0 55.9%
Taylor expanded in y around 0 28.4%
Final simplification28.4%
herbie shell --seed 2023285
(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))