From 0990ac4583587860af7b874b7834884ae0aa0250 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 6 Mar 2011 13:39:19 +0000 Subject: [PATCH] Added ULP base function --- glm/gtx/ulp.hpp | 2 +- glm/gtx/ulp.inl | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/glm/gtx/ulp.hpp b/glm/gtx/ulp.hpp index b15f08cf..18ce2f53 100644 --- a/glm/gtx/ulp.hpp +++ b/glm/gtx/ulp.hpp @@ -42,7 +42,7 @@ namespace glm }//namespace gtx }//namespace glm -#include "spline.inl" +#include "ulp.inl" namespace glm{using namespace gtx::spline;} diff --git a/glm/gtx/ulp.inl b/glm/gtx/ulp.inl index e69de29b..253f5b4e 100644 --- a/glm/gtx/ulp.inl +++ b/glm/gtx/ulp.inl @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-03-07 +// Updated : 2011-03-07 +// Licence : This source is under MIT License +// File : glm/gtx/ulp.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm{ +namespace gtx{ +namespace ulp +{ + inline std::size_t ulp + ( + double const & a, + double const & b + ) + { + std::size_t Count = 0; + double Temp = a; + while((Temp = nextafterf(Temp, b)) != b) + ++Count; + return Count; + } + + inline std::size_t ulp + ( + float const & a, + float const & b + ) + { + std::size_t Count = 0; + float Temp = a; + while((Temp = nextafterf(Temp, b)) != b) + ++Count; + return Count; + } +}//namespace ulp +}//namespace gtx +}//namespace glm