📄 float.hpp
字号:
/* * Open BEAGLE * Copyright (C) 2001-2005 by Christian Gagne and Marc Parizeau * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Contact: * Laboratoire de Vision et Systemes Numeriques * Departement de genie electrique et de genie informatique * Universite Laval, Quebec, Canada, G1K 7P4 * http://vision.gel.ulaval.ca * *//*! * \file beagle/Float.hpp * \brief Definition of the type Float and related operators. * \author Christian Gagne * \author Marc Parizeau * $Revision: 1.7 $ * $Date: 2005/09/30 15:04:54 $ */#ifndef Beagle_Float_hpp#define Beagle_Float_hpp#include "beagle/config.hpp"#include "beagle/macros.hpp"#include "beagle/WrapperT.hpp"#include "beagle/ArrayT.hpp"namespace Beagle {/*! * \brief Beagle wrapper of the atomic float type. * \ingroup Adapt */typedef WrapperT< float > Float;/*! * \brief Beagle array of the atomic float type. * \ingroup Adapt */typedef ArrayT< float > FloatArray;/*! * \brief Evaluate absolute value of a Beagle::Float. * \param inValue Float to evaluate the absolute value. * \return Absolute value of the input. * \ingroup Adapt */template <>inline Float absolute(const Float& inValue){ Beagle_StackTraceBeginM(); return Float(std::fabs(inValue.getWrappedValue())); Beagle_StackTraceEndM("Float absolute(const Float& inValue)");}}/*! * \brief Test whether an float is less than another. * \param inLeftFloat Left float compared. * \param inRightFloat Right float compared. * \return True if left float is less than the right one, false if not. * \par Note: * The operator is defined relatively to the function isLess of Beagle::Float. */inline bool operator<(const Beagle::Float& inLeftFloat, const Beagle::Float& inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.isLess(inRightFloat); Beagle_StackTraceEndM("bool operator<(const Float& inLeftFloat, const Float& inRightFloat)");}/*! * \brief Test whether an float is less than, or equal to another. * \param inLeftFloat Left float compared. * \param inRightFloat Right float compared. * \return True if left float is less than, or equal to the right one, false if not. * \par Note: * The operator is defined relatively to the functions isLess and isEqual of Beagle::Float. */inline bool operator<=(const Beagle::Float& inLeftFloat, const Beagle::Float& inRightFloat){ Beagle_StackTraceBeginM(); return ( inLeftFloat.isLess(inRightFloat) || inLeftFloat.isEqual(inRightFloat) ); Beagle_StackTraceEndM("bool operator<=(const Float& inLeftFloat, const Float& inRightFloat)");}/*! * \brief Test whether an float is more than another. * \param inLeftFloat Left float compared. * \param inRightFloat Right float compared. * \return True if left float is more than the right one, false if not. * \par Note: * The operator is defined relatively to the function isLess of Beagle::Float. */inline bool operator>(const Beagle::Float& inLeftFloat, const Beagle::Float& inRightFloat){ Beagle_StackTraceBeginM(); return inRightFloat.isLess(inLeftFloat); Beagle_StackTraceEndM("bool operator>(const Float& inLeftFloat, const Float& inRightFloat)");}/*! * \brief Test whether an float is more than, or equal to another. * \param inLeftFloat Left float compared. * \param inRightFloat Right float compared. * \return True if left float is more than, or equal to the right one, false if not. * \par Note: * The operator is defined relatively to the functions isLess and isEqual of Beagle::Float. */inline bool operator>=(const Beagle::Float& inLeftFloat, const Beagle::Float& inRightFloat){ Beagle_StackTraceBeginM(); return ( inRightFloat.isLess(inLeftFloat) || inLeftFloat.isEqual(inRightFloat) ); Beagle_StackTraceEndM("bool operator>=(const Float& inLeftFloat, const Float& inRightFloat)");}/*! * \brief Test whether an float is equal to another. * \param inLeftFloat Left float compared. * \param inRightFloat Right float compared. * \return True if left float is equal to the right one, false if not. * \par Note: * The operator is defined relatively to the function isEqual of Beagle::Float. */inline bool operator==(const Beagle::Float& inLeftFloat, const Beagle::Float& inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.isEqual(inRightFloat); Beagle_StackTraceEndM("bool operator==(const Float& inLeftFloat, const Float& inRightFloat)");}/*! * \brief Test whether an float is not equal to another. * \param inLeftFloat Left float compared. * \param inRightFloat Right float compared. * \return True if left float is not equal to the right one, false if it is. * \par Note: * The operator is defined relatively to the function isEqual of Beagle::Float. */inline bool operator!=(const Beagle::Float& inLeftFloat, const Beagle::Float& inRightFloat){ Beagle_StackTraceBeginM(); return ( inLeftFloat.isEqual(inRightFloat) == false); Beagle_StackTraceEndM("bool operator!=(const Float& inLeftFloat, const Float& inRightFloat)");}/*! * \brief Compare equality of a Float with a float. * \param inLeftFloat Left value to compare. * \param inRightFloat Right value to compare. * \return Result of the comparison. */inlinebool operator==(const Beagle::Float& inLeftFloat, float inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.getWrappedValue() == inRightFloat; Beagle_StackTraceEndM("bool operator==(const Float& inLeftFloat, float inRightFloat)");}/*! * \brief Compare inequality of a Float with a float. * \param inLeftFloat Left value to compare. * \param inRightFloat Right value to compare. * \return Result of the comparison. */inlinebool operator!=(const Beagle::Float& inLeftFloat, float inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.getWrappedValue() != inRightFloat; Beagle_StackTraceEndM("bool operator!=(const Float& inLeftFloat, float inRightFloat)");}/*! * \brief Test if a Float is < than a float. * \param inLeftFloat Left value to compare. * \param inRightFloat Right value to compare. * \return Result of the comparison. */inlinebool operator<(const Beagle::Float& inLeftFloat, float inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.getWrappedValue() < inRightFloat; Beagle_StackTraceEndM("bool operator<(const Float& inLeftFloat, float inRightFloat)");}/*! * \brief Test if a Float is <= than a float. * \param inLeftFloat Left value to compare. * \param inRightFloat Right value to compare. * \return Result of the comparison. */inlinebool operator<=(const Beagle::Float& inLeftFloat, float inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.getWrappedValue() <= inRightFloat; Beagle_StackTraceEndM("bool operator<=(const Float& inLeftFloat, float inRightFloat)");}/*! * \brief Test if a Float is > than a float. * \param inLeftFloat Left value to compare. * \param inRightFloat Right value to compare. * \return Result of the comparison. */inlinebool operator>(const Beagle::Float& inLeftFloat, float inRightFloat){ Beagle_StackTraceBeginM(); return inLeftFloat.getWrappedValue() > inRightFloat; Beagle_StackTraceEndM("bool operator>(const Float& inLeftFloat, float inRightFloat)");}/*! * \brief Test if a Float is >= than a float. * \param inLeftFloat Left value to compare. * \param inRightFloat Right value to compare. * \return Result of the comparison. */inlinebool operator>=(const Beagle::Float& inLeftFloat, float inRightFloat){ Beagle_StackTraceBeginM();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -