Vincenzo Comito / Mbed 2 deprecated AEB

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtGetNaN.cpp Source File

rtGetNaN.cpp

00001 /*
00002  * Academic License - for use in teaching, academic research, and meeting
00003  * course requirements at degree granting institutions only.  Not for
00004  * government, commercial, or other organizational use.
00005  *
00006  * File: rtGetNaN.c
00007  *
00008  * Code generated for Simulink model 'AEB0'.
00009  *
00010  * Model version                  : 1.63
00011  * Simulink Coder version         : 8.10 (R2016a) 10-Feb-2016
00012  * C/C++ source code generated on : Tue Jul 26 21:28:16 2016
00013  *
00014  * Target selection: ert.tlc
00015  * Embedded hardware selection: Intel->x86-64 (Windows64)
00016  * Code generation objectives: Unspecified
00017  * Validation result: Not run
00018  */
00019 
00020 /*
00021  * Abstract:
00022  *      Function to intialize non-finite, NaN
00023  */
00024 #include "rtGetNaN.h"
00025 #define NumBitsPerChar                 8U
00026 
00027 /*
00028  * Initialize rtNaN needed by the generated code.
00029  * NaN is initialized as non-signaling. Assumes IEEE.
00030  */
00031 real_T rtGetNaN(void)
00032 {
00033   size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
00034   real_T nan = 0.0;
00035   if (bitsPerReal == 32U) {
00036     nan = rtGetNaNF();
00037   } else {
00038     union {
00039       LittleEndianIEEEDouble bitVal;
00040       real_T fltVal;
00041     } tmpVal;
00042 
00043     tmpVal.bitVal.words.wordH = 0xFFF80000U;
00044     tmpVal.bitVal.words.wordL = 0x00000000U;
00045     nan = tmpVal.fltVal;
00046   }
00047 
00048   return nan;
00049 }
00050 
00051 /*
00052  * Initialize rtNaNF needed by the generated code.
00053  * NaN is initialized as non-signaling. Assumes IEEE.
00054  */
00055 real32_T rtGetNaNF(void)
00056 {
00057   IEEESingle nanF = { { 0 } };
00058 
00059   nanF.wordL.wordLuint = 0xFFC00000U;
00060   return nanF.wordL.wordLreal;
00061 }
00062 
00063 /*
00064  * File trailer for generated code.
00065  *
00066  * [EOF]
00067  */