DoxigAlpha

bufferSize

Returns the minimum buffer size needed to print every float of a specific type and format.

Function parameters

Parameters

#
T:type

Type definitions in this namespace

Types

#

Returns the minimum buffer size needed to print every float of a specific type and format.

Functions

#
bufferSize
Returns the minimum buffer size needed to print every float of a specific type and format.
render
Format a floating-point value and write it to buffer.
formatScientific
Write a FloatDecimal to a buffer in scientific form.
formatDecimal
Write a FloatDecimal to a buffer in decimal form.
binaryToDecimal
Convert a binary float representation to decimal.

Error sets in this namespace

Error Sets

#

Any buffer used for `format` must be at least this large.

Values

#
min_buffer_size
Any buffer used for `format` must be at least this large.

Source

Implementation

#
pub fn bufferSize(comptime mode: Mode, comptime T: type) comptime_int {
    comptime std.debug.assert(@typeInfo(T) == .float);
    return switch (mode) {
        .scientific => 53,
        // Based on minimum subnormal values.
        .decimal => switch (@bitSizeOf(T)) {
            16 => @max(15, min_buffer_size),
            32 => 55,
            64 => 347,
            80 => 4996,
            128 => 5011,
            else => unreachable,
        },
    };
}