MBSD / Mbed 2 deprecated AEB_TERATERM

Dependencies:   mbed

Fork of AEB by Vincenzo Comito

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtGetInf.cpp Source File

rtGetInf.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: rtGetInf.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, Inf
00023  */
00024 #include "rtGetInf.h"
00025 #define NumBitsPerChar                 8U
00026 
00027 /*
00028  * Initialize rtInf needed by the generated code.
00029  * Inf is initialized as non-signaling. Assumes IEEE.
00030  */
00031 real_T rtGetInf(void)
00032 {
00033   size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
00034   real_T inf = 0.0;
00035   if (bitsPerReal == 32U) {
00036     inf = rtGetInfF();
00037   } else {
00038     union {
00039       LittleEndianIEEEDouble bitVal;
00040       real_T fltVal;
00041     } tmpVal;
00042 
00043     tmpVal.bitVal.words.wordH = 0x7FF00000U;
00044     tmpVal.bitVal.words.wordL = 0x00000000U;
00045     inf = tmpVal.fltVal;
00046   }
00047 
00048   return inf;
00049 }
00050 
00051 /*
00052  * Initialize rtInfF needed by the generated code.
00053  * Inf is initialized as non-signaling. Assumes IEEE.
00054  */
00055 real32_T rtGetInfF(void)
00056 {
00057   IEEESingle infF;
00058   infF.wordL.wordLuint = 0x7F800000U;
00059   return infF.wordL.wordLreal;
00060 }
00061 
00062 /*
00063  * Initialize rtMinusInf needed by the generated code.
00064  * Inf is initialized as non-signaling. Assumes IEEE.
00065  */
00066 real_T rtGetMinusInf(void)
00067 {
00068   size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
00069   real_T minf = 0.0;
00070   if (bitsPerReal == 32U) {
00071     minf = rtGetMinusInfF();
00072   } else {
00073     union {
00074       LittleEndianIEEEDouble bitVal;
00075       real_T fltVal;
00076     } tmpVal;
00077 
00078     tmpVal.bitVal.words.wordH = 0xFFF00000U;
00079     tmpVal.bitVal.words.wordL = 0x00000000U;
00080     minf = tmpVal.fltVal;
00081   }
00082 
00083   return minf;
00084 }
00085 
00086 /*
00087  * Initialize rtMinusInfF needed by the generated code.
00088  * Inf is initialized as non-signaling. Assumes IEEE.
00089  */
00090 real32_T rtGetMinusInfF(void)
00091 {
00092   IEEESingle minfF;
00093   minfF.wordL.wordLuint = 0xFF800000U;
00094   return minfF.wordL.wordLreal;
00095 }
00096 
00097 /*
00098  * File trailer for generated code.
00099  *
00100  * [EOF]
00101  */