1/*
2 * Academic License - for use in teaching, academic research, and meeting
3 * course requirements at degree granting institutions only. Not for
4 * government, commercial, or other organizational use.
5 *
6 * File: rtGetNaN.c
7 *
8 * Code generated for Simulink model 'magneto_tarato'.
9 *
10 * Model version : 1.19
11 * Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
12 * C/C++ source code generated on : Tue Nov 07 14:03:19 2017
13 *
14 * Target selection: ert.tlc
15 * Embedded hardware selection: ARM Compatible->ARM Cortex
16 * Code generation objectives: Unspecified
17 * Validation result: Not run
18 */
19
20/*
21 * Abstract:
22 * Function to initialize non-finite, NaN
23 */
24#include "rtGetNaN.h"
25#define NumBitsPerChar 8U
26
27/*
28 * Initialize rtNaN needed by the generated code.
29 * NaN is initialized as non-signaling. Assumes IEEE.
30 */
31real_T rtGetNaN(void)
32{
33 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
34 real_T nan = 0.0;
35 if (bitsPerReal == 32U) {
36 nan = rtGetNaNF();
37 } else {
38 union {
39 LittleEndianIEEEDouble bitVal;
40 real_T fltVal;
41 } tmpVal;
42
43 tmpVal.bitVal.words.wordH = 0xFFF80000U;
44 tmpVal.bitVal.words.wordL = 0x00000000U;
45 nan = tmpVal.fltVal;
46 }
47
48 return nan;
49}
50
51/*
52 * Initialize rtNaNF needed by the generated code.
53 * NaN is initialized as non-signaling. Assumes IEEE.
54 */
55real32_T rtGetNaNF(void)
56{
57 IEEESingle nanF = { { 0 } };
58
59 nanF.wordL.wordLuint = 0xFFC00000U;
60 return nanF.wordL.wordLreal;
61}
62
63/*
64 * File trailer for generated code.
65 *
66 * [EOF]
67 */
68