123456789101112131415161718192021222324252627282930313233 |
- #include "rtwtypes.h"
- #include "rtGetNaN.h"
- #include <stddef.h>
- #include "rt_nonfinite.h"
- #define NumBitsPerChar 8U
- real_T rtGetNaN(void)
- {
- size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
- real_T nan = 0.0;
- if (bitsPerReal == 32U) {
- nan = rtGetNaNF();
- } else {
- union {
- LittleEndianIEEEDouble bitVal;
- real_T fltVal;
- } tmpVal;
- tmpVal.bitVal.words.wordH = 0xFFF80000U;
- tmpVal.bitVal.words.wordL = 0x00000000U;
- nan = tmpVal.fltVal;
- }
- return nan;
- }
- real32_T rtGetNaNF(void)
- {
- IEEESingle nanF = { { 0.0F } };
- nanF.wordL.wordLuint = 0xFFC00000U;
- return nanF.wordL.wordLreal;
- }
|