S2OPC OPCUA Toolkit
sopc_ieee_check.h
Go to the documentation of this file.
1 /*
2  * Licensed to Systerel under one or more contributor license
3  * agreements. See the NOTICE file distributed with this work
4  * for additional information regarding copyright ownership.
5  * Systerel licenses this file to you under the Apache
6  * License, Version 2.0 (the "License"); you may not use this
7  * file except in compliance with the License. You may obtain
8  * a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
26 #ifndef SOPC_IEEE_CHECK_H_
27 #define SOPC_IEEE_CHECK_H_
28 
29 #include <float.h>
30 #include <stdbool.h>
31 
40 bool SOPC_IEEE_Check(void);
41 
42 #if FLT_MAX_EXP != 128
43 #error "Compiler float definition differs from IEEE-754 standard"
44 #endif
45 
46 #if FLT_MIN_EXP != (-125)
47 #error "Compiler float definition differs from IEEE-754 standard"
48 #endif
49 
50 #if FLT_MANT_DIG != 24
51 #error "Compiler float definition differs from IEEE-754 standard"
52 #endif
53 
54 #if DBL_MAX_EXP != 1024
55 #error "Compiler double definition differs from IEEE-754 standard"
56 #endif
57 
58 #if DBL_MIN_EXP != (-1021)
59 #error "Compiler double definition differs from IEEE-754 standard"
60 #endif
61 
62 #if DBL_MANT_DIG != 53
63 #error "Compiler double definition differs from IEEE-754 standard"
64 #endif
65 
66 #endif
SOPC_IEEE_Check
bool SOPC_IEEE_Check(void)
Checks the floating-point compliance to IEEE-754 standard.