nRF Connect SDK API 2.8.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
23extern "C" {
24#endif
25
29 SFLOAT_NAN = 0x07FF,
30
32 SFLOAT_NRES = 0x0800,
33
36
39
42};
43
45struct 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
61struct sfloat sfloat_from_float(float float_num);
62
63#ifdef __cplusplus
64}
65#endif
66
71#endif /* SFLOAT_H_ */
struct sfloat sfloat_from_float(float float_num)
Convert the standard float type into SFLOAT type.
sfloat_special
SFLOAT special values.
Definition sfloat.h:27
@ SFLOAT_POS_INFINITY
Definition sfloat.h:35
@ SFLOAT_NRES
Definition sfloat.h:32
@ SFLOAT_NAN
Definition sfloat.h:29
@ SFLOAT_RESERVED
Definition sfloat.h:41
@ SFLOAT_NEG_INFINITY
Definition sfloat.h:38
uint16_t val
Definition sfloat.h:50
SFLOAT type.
Definition sfloat.h:45