PBRT
|
00001 00002 // 00003 // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas 00004 // Digital Ltd. LLC 00005 // 00006 // All rights reserved. 00007 // 00008 // Redistribution and use in source and binary forms, with or without 00009 // modification, are permitted provided that the following conditions are 00010 // met: 00011 // * Redistributions of source code must retain the above copyright 00012 // notice, this list of conditions and the following disclaimer. 00013 // * Redistributions in binary form must reproduce the above 00014 // copyright notice, this list of conditions and the following disclaimer 00015 // in the documentation and/or other materials provided with the 00016 // distribution. 00017 // * Neither the name of Industrial Light & Magic nor the names of 00018 // its contributors may be used to endorse or promote products derived 00019 // from this software without specific prior written permission. 00020 // 00021 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 // 00034 00035 00036 // Primary authors: 00037 // Florian Kainz <kainz@ilm.com> 00038 // Rod Bogart <rgb@ilm.com> 00039 00040 00041 #ifndef INCLUDED_HALF_LIMITS_H 00042 #define INCLUDED_HALF_LIMITS_H 00043 00044 00045 //------------------------------------------------------------------------ 00046 // 00047 // C++ standard library-style numeric_limits for class half 00048 // 00049 //------------------------------------------------------------------------ 00050 00051 #include <limits> 00052 #include "half.h" 00053 00054 namespace std { 00055 00056 template <> 00057 class numeric_limits <half> 00058 { 00059 public: 00060 00061 static const bool is_specialized = true; 00062 00063 static half min () throw () {return HALF_NRM_MIN;} 00064 static half max () throw () {return HALF_MAX;} 00065 00066 static const int digits = HALF_MANT_DIG; 00067 static const int digits10 = HALF_DIG; 00068 static const bool is_signed = true; 00069 static const bool is_integer = false; 00070 static const bool is_exact = false; 00071 static const int radix = HALF_RADIX; 00072 static half epsilon () throw () {return HALF_EPSILON;} 00073 static half round_error () throw () {return HALF_EPSILON / 2;} 00074 00075 static const int min_exponent = HALF_MIN_EXP; 00076 static const int min_exponent10 = HALF_MIN_10_EXP; 00077 static const int max_exponent = HALF_MAX_EXP; 00078 static const int max_exponent10 = HALF_MAX_10_EXP; 00079 00080 static const bool has_infinity = true; 00081 static const bool has_quiet_NaN = true; 00082 static const bool has_signaling_NaN = true; 00083 static const float_denorm_style has_denorm = denorm_present; 00084 static const bool has_denorm_loss = false; 00085 static half infinity () throw () {return half::posInf();} 00086 static half quiet_NaN () throw () {return half::qNan();} 00087 static half signaling_NaN () throw () {return half::sNan();} 00088 static half denorm_min () throw () {return HALF_MIN;} 00089 00090 static const bool is_iec559 = false; 00091 static const bool is_bounded = false; 00092 static const bool is_modulo = false; 00093 00094 static const bool traps = true; 00095 static const bool tinyness_before = false; 00096 static const float_round_style round_style = round_to_nearest; 00097 }; 00098 00099 00100 } // namespace std 00101 00102 #endif