updated ULP extension
This commit is contained in:
parent
0990ac4583
commit
84fef7d988
@ -15,13 +15,14 @@ namespace ulp
|
||||
{
|
||||
inline std::size_t ulp
|
||||
(
|
||||
double const & a,
|
||||
double const & b
|
||||
half const & a,
|
||||
half const & b
|
||||
)
|
||||
{
|
||||
std::size_t Count = 0;
|
||||
double Temp = a;
|
||||
while((Temp = nextafterf(Temp, b)) != b)
|
||||
float TempA = a;
|
||||
float TempB = b;
|
||||
while((TempA = nextafterf(TempA, TempB)) != TempB)
|
||||
++Count;
|
||||
return Count;
|
||||
}
|
||||
@ -38,6 +39,59 @@ namespace ulp
|
||||
++Count;
|
||||
return Count;
|
||||
}
|
||||
|
||||
inline std::size_t ulp
|
||||
(
|
||||
double const & a,
|
||||
double const & b
|
||||
)
|
||||
{
|
||||
std::size_t Count = 0;
|
||||
double Temp = a;
|
||||
while((Temp = nextafter(Temp, b)) != b)
|
||||
++Count;
|
||||
return Count;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
inline detail::xvec2<valType> ulp
|
||||
(
|
||||
detail::xvec2<valType> const & a,
|
||||
detail::xvec2<valType> const & b
|
||||
)
|
||||
{
|
||||
return detail::xvec2<valType>(
|
||||
ulp(a[0], b[0]),
|
||||
ulp(a[1], b[1]));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
inline detail::xvec3<valType> ulp
|
||||
(
|
||||
detail::xvec3<valType> const & a,
|
||||
detail::xvec3<valType> const & b
|
||||
)
|
||||
{
|
||||
return detail::xvec2<valType>(
|
||||
ulp(a[0], b[0]),
|
||||
ulp(a[1], b[1]),
|
||||
ulp(a[2], b[2]));
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
inline detail::xvec4<valType> ulp
|
||||
(
|
||||
detail::xvec4<valType> const & a,
|
||||
detail::xvec4<valType> const & b
|
||||
)
|
||||
{
|
||||
return detail::xvec2<valType>(
|
||||
ulp(a[0], b[0]),
|
||||
ulp(a[1], b[1]),
|
||||
ulp(a[2], b[2]),
|
||||
ulp(a[3], b[3]));
|
||||
}
|
||||
|
||||
}//namespace ulp
|
||||
}//namespace gtx
|
||||
}//namespace glm
|
||||
|
Loading…
Reference in New Issue
Block a user