source: mainline/uspace/lib/c/include/ieee_double.h@ cd1e3fc0

Last change on this file since cd1e3fc0 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2012 Adam Hraska
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef IEEE_DOUBLE_H_
8#define IEEE_DOUBLE_H_
9
10#include <stdint.h>
11#include <stdbool.h>
12
13/** Represents a non-negative floating point number: significand * 2^exponent */
14typedef struct fp_num_t_tag {
15 /** Significand (aka mantissa). */
16 uint64_t significand;
17 /** Binary exponent. */
18 int exponent;
19} fp_num_t;
20
21/** Double number description according to IEEE 754. */
22typedef struct ieee_double_t_tag {
23 /** The number is a NaN or infinity. */
24 bool is_special;
25 /** Not a number. */
26 bool is_nan;
27 bool is_negative;
28 /** The number denoted infinity. */
29 bool is_infinity;
30 /** The number could not be represented as a normalized double. */
31 bool is_denormal;
32 /**
33 * The predecessor double is closer than the successor. This happens
34 * if a normal number is of the form 2^k and it is not the smallest
35 * normal number.
36 */
37 bool is_accuracy_step;
38 /**
39 * If !is_special the double's value is:
40 * pos_val.significand * 2^pos_val.exponent
41 */
42 fp_num_t pos_val;
43} ieee_double_t;
44
45extern ieee_double_t extract_ieee_double(double);
46
47#endif
Note: See TracBrowser for help on using the repository browser.