Mercurial > hg > octave-lyh
comparison liboctave/lo-ieee.h @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | a1dbe9d80eee |
children | 87865ed7405f |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
35 extern OCTAVE_API double octave_NA; | 35 extern OCTAVE_API double octave_NA; |
36 | 36 |
37 /* Octave's idea of not a number. */ | 37 /* Octave's idea of not a number. */ |
38 extern OCTAVE_API double octave_NaN; | 38 extern OCTAVE_API double octave_NaN; |
39 | 39 |
40 /* Octave's idea of infinity. */ | |
41 extern OCTAVE_API float octave_Float_Inf; | |
42 | |
43 /* Octave's idea of a missing value. */ | |
44 extern OCTAVE_API float octave_Float_NA; | |
45 | |
46 /* Octave's idea of not a number. */ | |
47 extern OCTAVE_API float octave_Float_NaN; | |
48 | |
40 /* FIXME -- this code assumes that a double has twice the | 49 /* FIXME -- this code assumes that a double has twice the |
41 number of bits as an int */ | 50 number of bits as an int */ |
42 | 51 |
43 extern OCTAVE_API int lo_ieee_hw; | 52 extern OCTAVE_API int lo_ieee_hw; |
44 extern OCTAVE_API int lo_ieee_lw; | 53 extern OCTAVE_API int lo_ieee_lw; |
47 { | 56 { |
48 double value; | 57 double value; |
49 unsigned int word[2]; | 58 unsigned int word[2]; |
50 } lo_ieee_double; | 59 } lo_ieee_double; |
51 | 60 |
61 typedef union | |
62 { | |
63 double value; | |
64 unsigned int word; | |
65 } lo_ieee_float; | |
66 | |
52 #define LO_IEEE_NA_HW 0x7ff00000 | 67 #define LO_IEEE_NA_HW 0x7ff00000 |
53 #define LO_IEEE_NA_LW 1954 | 68 #define LO_IEEE_NA_LW 1954 |
69 #define LO_IEEE_NA_FLOAT 0x7ff007a2 | |
70 #define LO_IEEE_NA_FLOAT_LW 0x07a2 | |
54 | 71 |
55 extern OCTAVE_API void octave_ieee_init (void); | 72 extern OCTAVE_API void octave_ieee_init (void); |
56 | 73 |
57 #if defined (SCO) | 74 #if defined (SCO) |
58 extern int isnan (double); | 75 extern int __isnan (double); |
59 extern int isinf (double); | 76 extern int __isinf (double); |
77 extern int __isnanf (float); | |
78 extern int __isinff (float); | |
79 | |
80 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) | |
81 #define isinf(x) (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) | |
60 #endif | 82 #endif |
61 | 83 |
62 extern OCTAVE_API int lo_ieee_isnan (double x); | 84 extern OCTAVE_API int __lo_ieee_isnan (double x); |
63 extern OCTAVE_API int lo_ieee_finite (double x); | 85 extern OCTAVE_API int __lo_ieee_finite (double x); |
64 extern OCTAVE_API int lo_ieee_isinf (double x); | 86 extern OCTAVE_API int __lo_ieee_isinf (double x); |
65 | 87 |
66 extern OCTAVE_API int lo_ieee_is_NA (double); | 88 extern OCTAVE_API int __lo_ieee_is_NA (double); |
67 extern OCTAVE_API int lo_ieee_is_NaN_or_NA (double) GCC_ATTR_DEPRECATED; | 89 extern OCTAVE_API int __lo_ieee_is_NaN_or_NA (double) GCC_ATTR_DEPRECATED; |
68 | 90 |
69 extern OCTAVE_API double lo_ieee_inf_value (void); | 91 extern OCTAVE_API double lo_ieee_inf_value (void); |
70 extern OCTAVE_API double lo_ieee_na_value (void); | 92 extern OCTAVE_API double lo_ieee_na_value (void); |
71 extern OCTAVE_API double lo_ieee_nan_value (void); | 93 extern OCTAVE_API double lo_ieee_nan_value (void); |
72 | 94 |
73 extern OCTAVE_API int lo_ieee_signbit (double); | 95 extern OCTAVE_API int __lo_ieee_signbit (double); |
96 | |
97 extern OCTAVE_API int __lo_ieee_float_isnan (float x); | |
98 extern OCTAVE_API int __lo_ieee_float_finite (float x); | |
99 extern OCTAVE_API int __lo_ieee_float_isinf (float x); | |
100 | |
101 extern OCTAVE_API int __lo_ieee_float_is_NA (float); | |
102 extern OCTAVE_API int __lo_ieee_float_is_NaN_or_NA (float) GCC_ATTR_DEPRECATED; | |
103 | |
104 extern OCTAVE_API float lo_ieee_float_inf_value (void); | |
105 extern OCTAVE_API float lo_ieee_float_na_value (void); | |
106 extern OCTAVE_API float lo_ieee_float_nan_value (void); | |
107 | |
108 extern OCTAVE_API int __lo_ieee_float_signbit (float); | |
74 | 109 |
75 #ifdef __cplusplus | 110 #ifdef __cplusplus |
76 } | 111 } |
77 #endif | 112 #endif |
113 | |
114 #define lo_ieee_isnan(x) (sizeof (x) == sizeof (float) ? \ | |
115 __lo_ieee_float_isnan (x) : __lo_ieee_isnan (x)) | |
116 #define lo_ieee_finite(x) (sizeof (x) == sizeof (float) ? \ | |
117 __lo_ieee_float_finite (x) : __lo_ieee_finite (x)) | |
118 #define lo_ieee_isinf(x) (sizeof (x) == sizeof (float) ? \ | |
119 __lo_ieee_float_isinf (x) : __lo_ieee_isinf (x)) | |
120 | |
121 | |
122 #define lo_ieee_is_NA(x) (sizeof (x) == sizeof (float) ? \ | |
123 __lo_ieee_float_is_NA (x) : __lo_ieee_is_NA (x)) | |
124 #define lo_ieee_is_NaN_or_NA(x) (sizeof (x) == sizeof (float) ? \ | |
125 __lo_ieee_float_is_NaN_or_NA (x) : __lo_ieee_is_NaN_or_NA (x)) | |
126 #define lo_ieee_signbit(x) (sizeof (x) == sizeof (float) ? \ | |
127 __lo_ieee_float_signbit (x) : __lo_ieee_signbit (x)) | |
78 | 128 |
79 #endif | 129 #endif |
80 | 130 |
81 /* | 131 /* |
82 ;;; Local Variables: *** | 132 ;;; Local Variables: *** |