/usr/include/oce/Standard_Real.hxx is in liboce-foundation-dev 0.17.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | // Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Standard_Real_HeaderFile
#define _Standard_Real_HeaderFile
#include <float.h>
#include <math.h>
#include <Standard_values.h>
#include <Standard_math.hxx>
#include <Standard_TypeDef.hxx>
// ===============================================
// Methods from Standard_Entity class which are redefined:
// - Hascode
// - IsEqual
// - IsSimilar
// ===============================================
// ==================================
// Methods implemeted in Standard_Real.cxx
// ==================================
//.... Herited from Standard_Storable
__Standard_API Standard_Integer HashCode (const Standard_Real, const Standard_Integer);
__Standard_API Standard_Real ACos (const Standard_Real );
__Standard_API Standard_Real ACosApprox (const Standard_Real );
__Standard_API Standard_Real ASin (const Standard_Real );
__Standard_API Standard_Real ATan2 (const Standard_Real , const Standard_Real );
__Standard_API Standard_Real NextAfter (const Standard_Real , const Standard_Real );
__Standard_API Standard_Real Sign (const Standard_Real , const Standard_Real );
__Standard_API Standard_Real ATanh (const Standard_Real );
__Standard_API Standard_Real ACosh (const Standard_Real );
__Standard_API Standard_Real Log (const Standard_Real );
__Standard_API Standard_Real Sqrt (const Standard_Real );
//-------------------------------------------------------------------
// RealSmall : Returns the smallest positive real
//-------------------------------------------------------------------
inline Standard_Real RealSmall()
{ return DBL_MIN; }
//-------------------------------------------------------------------
// Abs : Returns the absolute value of a real
//-------------------------------------------------------------------
inline Standard_Real Abs(const Standard_Real Value)
{ return fabs(Value); }
//-------------------------------------------------------------------
// IsEqual : Returns Standard_True if two reals are equal
//-------------------------------------------------------------------
inline Standard_Boolean IsEqual (const Standard_Real Value1,
const Standard_Real Value2)
{ return Abs((Value1 - Value2)) < RealSmall(); }
//-------------------------------------------------------------------
// IsSimilar : Returns Standard_True if two reals are equal
//-------------------------------------------------------------------
inline Standard_Boolean IsSimilar(const Standard_Real One,
const Standard_Real Two)
{ return IsEqual (One,Two); }
// *********************************** //
// Class methods //
// //
// Machine-dependant values //
// Should be taken from include file //
// *********************************** //
//-------------------------------------------------------------------
// RealDigit : Returns the number of digits of precision in a real
//-------------------------------------------------------------------
inline Standard_Integer RealDigits()
{ return DBL_DIG; }
//-------------------------------------------------------------------
// RealEpsilon : Returns the minimum positive real such that
// 1.0 + x is not equal to 1.0
//-------------------------------------------------------------------
inline Standard_Real RealEpsilon()
{ return DBL_EPSILON; }
//-------------------------------------------------------------------
// RealFirst : Returns the minimum negative value of a real
//-------------------------------------------------------------------
inline Standard_Real RealFirst()
{ return -DBL_MAX; }
//-------------------------------------------------------------------
// RealFirst10Exp : Returns the minimum value of exponent(base 10) of
// a real.
//-------------------------------------------------------------------
inline Standard_Integer RealFirst10Exp()
{ return DBL_MIN_10_EXP; }
//-------------------------------------------------------------------
// RealLast : Returns the maximum value of a real
//-------------------------------------------------------------------
inline Standard_Real RealLast()
{ return DBL_MAX; }
//-------------------------------------------------------------------
// RealLast10Exp : Returns the maximum value of exponent(base 10) of
// a real.
//-------------------------------------------------------------------
inline Standard_Integer RealLast10Exp()
{ return DBL_MAX_10_EXP; }
//-------------------------------------------------------------------
// RealMantissa : Returns the size in bits of the matissa part of a
// real.
//-------------------------------------------------------------------
inline Standard_Integer RealMantissa()
{ return DBL_MANT_DIG; }
//-------------------------------------------------------------------
// RealRadix : Returns the radix of exponent representation
//-------------------------------------------------------------------
inline Standard_Integer RealRadix()
{ return FLT_RADIX; }
//-------------------------------------------------------------------
// RealSize : Returns the size in bits of an integer
//-------------------------------------------------------------------
inline Standard_Integer RealSize()
{ return BITS(Standard_Real); }
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
// End of machine-dependant values //
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
//-------------------------------------------------------------------
// IntToReal : Converts an integer in a real
//-------------------------------------------------------------------
inline Standard_Real IntToReal(const Standard_Integer Value)
{ return Value; }
//-------------------------------------------------------------------
// ATan : Returns the value of the arc tangent of a real
//-------------------------------------------------------------------
inline Standard_Real ATan(const Standard_Real Value)
{ return atan(Value); }
//-------------------------------------------------------------------
// Ceiling : Returns the smallest integer not less than a real
//-------------------------------------------------------------------
inline Standard_Real Ceiling (const Standard_Real Value)
{ return ceil(Value); }
//-------------------------------------------------------------------
// Cos : Returns the cosine of a real
//-------------------------------------------------------------------
inline Standard_Real Cos (const Standard_Real Value)
{ return cos(Value); }
//-------------------------------------------------------------------
// Cosh : Returns the hyperbolic cosine of a real
//-------------------------------------------------------------------
inline Standard_Real Cosh (const Standard_Real Value)
{ return cosh(Value); }
//-------------------------------------------------------------------
// Epsilon : The function returns absolute value of difference
// between 'Value' and other nearest value of
// Standard_Real type.
// Nearest value is choseen in direction of infinity
// the same sign as 'Value'.
// If 'Value' is 0 then returns minimal positive value
// of Standard_Real type.
//-------------------------------------------------------------------
inline Standard_Real Epsilon (const Standard_Real Value)
{
Standard_Real aEpsilon;
if (Value>=0.0){
aEpsilon = NextAfter(Value, RealLast()) - Value;
} else {
aEpsilon = Value - NextAfter(Value, RealFirst());
}
return aEpsilon;
}
//-------------------------------------------------------------------
// Exp : Returns the exponential function of a real
//-------------------------------------------------------------------
inline Standard_Real Exp (const Standard_Real Value)
{ return exp(Value); }
//-------------------------------------------------------------------
// Floor : Return the largest integer not greater than a real
//-------------------------------------------------------------------
inline Standard_Real Floor (const Standard_Real Value)
{ return floor(Value); }
//-------------------------------------------------------------------
// IntegerPart : Returns the integer part of a real
//-------------------------------------------------------------------
inline Standard_Real IntegerPart (const Standard_Real Value)
{ return ( (Value>0) ? floor(Value) : ceil(Value) ); }
//-------------------------------------------------------------------
// Log10 : Returns the base-10 logarithm of a real
//-------------------------------------------------------------------
inline Standard_Real Log10 (const Standard_Real Value)
{ return log10(Value); }
//-------------------------------------------------------------------
// Max : Returns the maximum value of two reals
//-------------------------------------------------------------------
inline Standard_Real Max (const Standard_Real Val1,
const Standard_Real Val2)
{
return Val1 >= Val2 ? Val1 : Val2;
}
//-------------------------------------------------------------------
// Min : Returns the minimum value of two reals
//-------------------------------------------------------------------
inline Standard_Real Min (const Standard_Real Val1,
const Standard_Real Val2)
{
return Val1 <= Val2 ? Val1 : Val2;
}
//-------------------------------------------------------------------
// Pow : Returns a real to a given power
//-------------------------------------------------------------------
inline Standard_Real Pow (const Standard_Real Value, const Standard_Real P)
{ return pow(Value,P); }
//-------------------------------------------------------------------
// RealPart : Returns the fractional part of a real.
//-------------------------------------------------------------------
inline Standard_Real RealPart (const Standard_Real Value)
{ return fabs(IntegerPart(Value) - Value); }
//-------------------------------------------------------------------
// RealToInt : Returns the real converted to nearest valid integer.
// If input value is out of valid range for integers,
// minimal or maximal possible integer is returned.
//-------------------------------------------------------------------
inline Standard_Integer RealToInt (const Standard_Real Value)
{
// Note that on WNT under MS VC++ 8.0 conversion of double value less
// than INT_MIN or greater than INT_MAX to integer will cause signal
// "Floating point multiple trap" (OCC17861)
return Value < INT_MIN ? INT_MIN
: Value > INT_MAX ? INT_MAX
: (Standard_Integer)Value;
}
// =======================================================================
// function : RealToShortReal
// purpose : Converts Standard_Real value to the nearest valid
// Standard_ShortReal. If input value is out of valid range
// for Standard_ShortReal, minimal or maximal
// Standard_ShortReal is returned.
// =======================================================================
inline Standard_ShortReal RealToShortReal (const Standard_Real theVal)
{
return theVal < -FLT_MAX ? -FLT_MAX
: theVal > FLT_MAX ? FLT_MAX
: (Standard_ShortReal)theVal;
}
//-------------------------------------------------------------------
// Round : Returns the nearest integer of a real
//-------------------------------------------------------------------
inline Standard_Real Round (const Standard_Real Value)
{ return IntegerPart(Value + (Value > 0 ? 0.5 : -0.5)); }
//-------------------------------------------------------------------
// Sin : Returns the sine of a real
//-------------------------------------------------------------------
inline Standard_Real Sin (const Standard_Real Value)
{ return sin(Value); }
//-------------------------------------------------------------------
// Sinh : Returns the hyperbolic sine of a real
//-------------------------------------------------------------------
inline Standard_Real Sinh(const Standard_Real Value)
{ return sinh(Value); }
//-------------------------------------------------------------------
// ASinh : Returns the hyperbolic arc sine of a real
//-------------------------------------------------------------------
inline Standard_Real ASinh(const Standard_Real Value)
{ return asinh(Value); }
//-------------------------------------------------------------------
// Square : Returns a real to the power 2
//-------------------------------------------------------------------
inline Standard_Real Square(const Standard_Real Value)
{ return Value * Value; }
//-------------------------------------------------------------------
// Tan : Returns the tangent of a real
//-------------------------------------------------------------------
inline Standard_Real Tan (const Standard_Real Value)
{ return tan(Value); }
//-------------------------------------------------------------------
// Tanh : Returns the hyperbolic tangent of a real
//-------------------------------------------------------------------
inline Standard_Real Tanh (const Standard_Real Value)
{ return tanh(Value); }
#endif
|