00001 /* 00002 This file is part of the BIAS library (Basic ImageAlgorithmS). 00003 00004 Copyright (C) 2003-2009 (see file CONTACT for details) 00005 Multimediale Systeme der Informationsverarbeitung 00006 Institut fuer Informatik 00007 Christian-Albrechts-Universitaet Kiel 00008 00009 00010 BIAS is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation; either version 2.1 of the License, or 00013 (at your option) any later version. 00014 00015 BIAS is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with BIAS; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 00026 /** 00027 @example ExampleCompare.cpp 00028 @class ExampleCompare 00029 @relates CompareFloatingPoint 00030 @brief Example for comparing two floats 00031 @ingroup g_examples 00032 @author MIP 00033 */ 00034 00035 #include <Base/Common/CompareFloatingPoint.hh> 00036 #include <iostream> 00037 #include <limits> 00038 00039 using namespace std; 00040 using namespace BIAS; 00041 00042 int main(){ 00043 double l=1.0e-50, r=1e-49; 00044 cout << l<<" == "<<r<<" is "<<boolalpha << Equal(l, r) << endl; 00045 00046 BIAS::Less(l, -std::numeric_limits<double>::max()); 00047 00048 return 0; 00049 00050 }
1.5.6