1 File kernel/include/ftoa.h

Functionality for converting floats to strings inside the kernel, used primarily for logging.

Author:

Juniper Beatitudes

1.1 Structures and Types

Type Name
enum bea_ftoa_result
The result indicator of the bea_ftoa_ function._

1.2 Functions

Type Name
enum bea_ftoa_result bea_ftoa (float x, char *buf, size_t n_available, bool include_positive_sign)
Fills a buffer with a string representation of a single-precision IEEE-754 floating point number.

1.3 Structures and Types Documentation

1.3.1 enum bea_ftoa_result

The result indicator of the bea_ftoa_ function._

enum bea_ftoa_result {
    BEA_FTOA_SUCCESS,
    BEA_FTOA_ENOSPACE,
    BEA_FTOA_WPRECISIONLOSS
};

1.4 Functions Documentation

1.4.1 function bea_ftoa

Fills a buffer with a string representation of a single-precision IEEE-754 floating point number.

enum bea_ftoa_result bea_ftoa (
    float x,
    char *buf,
    size_t n_available,
    bool include_positive_sign
) 

Parameters:

Returns:

BEA_FTOA_SUCCESS Represents a fully successful run with no loss-of-precision warning

Returns:

BEA_FTOA_ENOSPACE Indicates that there is insufficient space in the buffer to represent the integral portion of the number

Returns:

BEA_FTOA_WPRECISIONLOSS Indicates that there are more significant digits emitted than a single-precision floating point number actually has

Todo

Add support for emitting INF, NaN

Add support for scientific notation