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: rtGetInf.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, Inf
23 */
24#include "rtGetInf.h"
25#define NumBitsPerChar 8U
26
27/*
28 * Initialize rtInf needed by the generated code.
29 * Inf is initialized as non-signaling. Assumes IEEE.
30 */
31real_T rtGetInf(void)
32{
33 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
34 real_T inf = 0.0;
35 if (bitsPerReal == 32U) {
36 inf = rtGetInfF();
37 } else {
38 union {
39 LittleEndianIEEEDouble bitVal;
40 real_T fltVal;
41 } tmpVal;
42
43 tmpVal.bitVal.words.wordH = 0x7FF00000U;
44 tmpVal.bitVal.words.wordL = 0x00000000U;
45 inf = tmpVal.fltVal;
46 }
47
48 return inf;
49}
50
51/*
52 * Initialize rtInfF needed by the generated code.
53 * Inf is initialized as non-signaling. Assumes IEEE.
54 */
55real32_T rtGetInfF(void)
56{
57 IEEESingle infF;
58 infF.wordL.wordLuint = 0x7F800000U;
59 return infF.wordL.wordLreal;
60}
61
62/*
63 * Initialize rtMinusInf needed by the generated code.
64 * Inf is initialized as non-signaling. Assumes IEEE.
65 */
66real_T rtGetMinusInf(void)
67{
68 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
69 real_T minf = 0.0;
70 if (bitsPerReal == 32U) {
71 minf = rtGetMinusInfF();
72 } else {
73 union {
74 LittleEndianIEEEDouble bitVal;
75 real_T fltVal;
76 } tmpVal;
77
78 tmpVal.bitVal.words.wordH = 0xFFF00000U;
79 tmpVal.bitVal.words.wordL = 0x00000000U;
80 minf = tmpVal.fltVal;
81 }
82
83 return minf;
84}
85
86/*
87 * Initialize rtMinusInfF needed by the generated code.
88 * Inf is initialized as non-signaling. Assumes IEEE.
89 */
90real32_T rtGetMinusInfF(void)
91{
92 IEEESingle minfF;
93 minfF.wordL.wordLuint = 0xFF800000U;
94 return minfF.wordL.wordLreal;
95}
96
97/*
98 * File trailer for generated code.
99 *
100 * [EOF]
101 */
102