Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.cpp
double TimeViewPlugin::RoundDouble(double x) const
    {
        if ((std::numeric_limits<double>::max() - 0.5) <= x)
        {
            return std::numeric_limits<double>::max();
        }

        if ((-1 * std::numeric_limits<double>::max() + 0.5) > x)
        {
            return (-1 * std::numeric_limits<double>::max());
        }

        double intpart;
        double fractpart = modf(x, &intpart);

        if (fractpart >= 0.5)
        {
            return (intpart + 1);
        }
        else
        if (fractpart >= -0.5)
        {
            return intpart;
        }
        else
        {
            return (intpart - 1);
        }
    }
// round a double based on 0.5 (everything above is rounded up, everything else rounded down)
round a double based on 0.5 (everything above is rounded up, everything else rounded down)
round a double based on 0 . 5 ( everything above is rounded up everything else rounded down )
double TimeViewPlugin::RoundDouble(double x) const
    {
        if ((std::numeric_limits<double>::max() - 0.5) <= x)
        {
            return std::numeric_limits<double>::max();
        }
        if ((-1 * std::numeric_limits<double>::max() + 0.5) > x)
        {
            return (-1 * std::numeric_limits<double>::max());
        }
        double intpart;
        double fractpart = modf(x, &intpart);
        if (fractpart >= 0.5)
        {
            return (intpart + 1);
        }
        else
        if (fractpart >= -0.5)
        {
            return intpart;
        }
        else
        {
            return (intpart - 1);
        }
    }
double TimeViewPlugin :: RoundDouble ( double x ) const { if ( ( std :: numeric_limits < double > :: max ( ) - 0.5 ) <= x ) { return std :: numeric_limits < double > :: max ( ) ; } if ( ( -1 * std :: numeric_limits < double > :: max ( ) + 0.5 ) > x ) { return ( -1 * std :: numeric_limits < double > :: max ( ) ) ; } double intpart ; double fractpart = modf ( x , & intpart ) ; if ( fractpart >= 0.5 ) { return ( intpart + 1 ) ; } else if ( fractpart >= -0.5 ) { return intpart ; } else { return ( intpart - 1 ) ; } }
round a double based on 0.5 (everything above is rounded up, everything else rounded down)
round a double based on 0 . 5 ( everything above is rounded up everything else rounded down )