blob: ed7c7d8fcfed3e354e726f169b48d11ca5a12902 (
plain)
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
|
#ifndef _Standard_ShortReal_HeaderFile
#define _Standard_ShortReal_HeaderFile
#include <float.h>
#include <math.h>
#ifndef _Standard_values_HeaderFile
# include <Standard_values.h>
#endif
#ifndef _Standard_TypeDef_HeaderFile
#include <Standard_TypeDef.hxx>
#endif
class Handle_Standard_Type;
__Standard_API Handle_Standard_Type& Standard_ShortReal_Type_();
//class Standard_OStream;
//void ShallowDump (const Standard_ShortReal, Standard_OStream& );
// *********************************** //
// Class methods //
// //
// Machine-dependant values //
// Should be taken from include file //
// *********************************** //
//-------------------------------------------------------------------
// ShortRealSmall : Returns the smallest positive ShortReal
//-------------------------------------------------------------------
inline Standard_ShortReal ShortRealSmall()
{ return FLT_MIN; }
//-------------------------------------------------------------------
// Abs : Returns the absolute value of a ShortReal
//-------------------------------------------------------------------
inline Standard_ShortReal Abs(const Standard_ShortReal Value)
#if defined (__alpha) || defined(DECOSF1)
{ return fabsf(Value); }
#else
{ return float( fabs (Value) ) ; }
#endif
//-------------------------------------------------------------------
// ShortRealDigit : Returns the number of digits of precision in a ShortReal
//-------------------------------------------------------------------
inline Standard_Integer ShortRealDigits()
{ return FLT_DIG; }
//-------------------------------------------------------------------
// ShortRealEpsilon : Returns the minimum positive ShortReal such that
// 1.0 + x is not equal to 1.0
//-------------------------------------------------------------------
inline Standard_ShortReal ShortRealEpsilon()
{ return FLT_EPSILON; }
//-------------------------------------------------------------------
// ShortRealFirst : Returns the minimum negative value of a ShortReal
//-------------------------------------------------------------------
inline Standard_ShortReal ShortRealFirst()
{ Standard_ShortReal MaxFloatTmp = -FLT_MAX;
return MaxFloatTmp; }
//-------------------------------------------------------------------
// ShortRealFirst10Exp : Returns the minimum value of exponent(base 10) of
// a ShortReal.
//-------------------------------------------------------------------
inline Standard_Integer ShortRealFirst10Exp()
{ return FLT_MIN_10_EXP; }
//-------------------------------------------------------------------
// ShortRealLast : Returns the maximum value of a ShortReal
//-------------------------------------------------------------------
inline Standard_ShortReal ShortRealLast()
{ return FLT_MAX; }
//-------------------------------------------------------------------
// ShortRealLast10Exp : Returns the maximum value of exponent(base 10) of
// a ShortReal.
//-------------------------------------------------------------------
inline Standard_Integer ShortRealLast10Exp()
{ return FLT_MAX_10_EXP; }
//-------------------------------------------------------------------
// ShortRealMantissa : Returns the size in bits of the matissa part of a
// ShortReal.
//-------------------------------------------------------------------
inline Standard_Integer ShortRealMantissa()
{ return FLT_MANT_DIG; }
//-------------------------------------------------------------------
// ShortRealRadix : Returns the radix of exponent representation
//-------------------------------------------------------------------
inline Standard_Integer ShortRealRadix()
{ return FLT_RADIX; }
//-------------------------------------------------------------------
// ShortRealSize : Returns the size in bits of an integer
//-------------------------------------------------------------------
inline Standard_Integer ShortRealSize()
{ return BITS(Standard_ShortReal); }
//-------------------------------------------------------------------
// Max : Returns the maximum value of two ShortReals
//-------------------------------------------------------------------
inline Standard_ShortReal Max (const Standard_ShortReal Val1,
const Standard_ShortReal Val2)
{
if (Val1 >= Val2) {
return Val1;
} else {
return Val2;
}
}
//-------------------------------------------------------------------
// Min : Returns the minimum value of two ShortReals
//-------------------------------------------------------------------
inline Standard_ShortReal Min (const Standard_ShortReal Val1,
const Standard_ShortReal Val2)
{
if (Val1 <= Val2) {
return Val1;
} else {
return Val2;
}
}
// ===============================================
// Methods from Standard_Entity class which are redefined:
// - Hascode
// - IsEqual
// - IsSimilar
// - Shallowcopy
// - ShallowDump
// ===============================================
// ==================================
// Methods implemeted in Standard_ShortReal.cxx
// ==================================
//.... Herited from Standard_Storable
__Standard_API Standard_Integer HashCode (const Standard_ShortReal, const Standard_Integer);
__Standard_API Standard_ShortReal ShallowCopy (const Standard_ShortReal );
//-------------------------------------------------------------------
// IsEqual : Returns Standard_True if two ShortReals are equal
//-------------------------------------------------------------------
inline Standard_Boolean IsEqual (const Standard_ShortReal Value1,
const Standard_ShortReal Value2)
{ return Abs((Value1 - Value2)) < ShortRealSmall(); }
//-------------------------------------------------------------------
// IsSimilar : Returns Standard_True if two ShortReals are equal
//-------------------------------------------------------------------
inline Standard_Boolean IsSimilar(const Standard_ShortReal One,
const Standard_ShortReal Two)
{ return IsEqual (One,Two); }
#endif
|