nRF Connect SDK API
0.1.0
Loading...
Searching...
No Matches
sfloat.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022 Nordic Semiconductor ASA
3
*
4
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5
*/
6
7
#ifndef SFLOAT_H_
8
#define SFLOAT_H_
9
10
#include <stdint.h>
11
#include <zephyr/types.h>
12
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
27
enum
sfloat_special
{
29
SFLOAT_NAN
= 0x07FF,
30
32
SFLOAT_NRES
= 0x0800,
33
35
SFLOAT_POS_INFINITY
= 0x07FE,
36
38
SFLOAT_NEG_INFINITY
= 0x0802,
39
41
SFLOAT_RESERVED
= 0x0801,
42
};
43
45
struct
sfloat
{
46
/* SFLOAT type encoded as 16-bit word that consists of the following fields:
47
* 1. Exponent, encoded as 4-bit integer in two's-complement form.
48
* 2. Mantissa, encoded as 12-bit integer in two's-complement form.
49
*/
50
uint16_t
val
;
51
};
52
61
struct
sfloat
sfloat_from_float
(float float_num);
62
63
#ifdef __cplusplus
64
}
65
#endif
66
71
#endif
/* SFLOAT_H_ */
sfloat_from_float
struct sfloat sfloat_from_float(float float_num)
Convert the standard float type into SFLOAT type.
sfloat_special
sfloat_special
SFLOAT special values.
Definition:
sfloat.h:27
SFLOAT_POS_INFINITY
@ SFLOAT_POS_INFINITY
Definition:
sfloat.h:35
SFLOAT_NRES
@ SFLOAT_NRES
Definition:
sfloat.h:32
SFLOAT_NAN
@ SFLOAT_NAN
Definition:
sfloat.h:29
SFLOAT_RESERVED
@ SFLOAT_RESERVED
Definition:
sfloat.h:41
SFLOAT_NEG_INFINITY
@ SFLOAT_NEG_INFINITY
Definition:
sfloat.h:38
sfloat::val
uint16_t val
Definition:
sfloat.h:50
sfloat
SFLOAT type.
Definition:
sfloat.h:45
include
sfloat.h
Generated on Thu Sep 26 2024 10:53:16 for nRF Connect SDK API by
1.9.6