copySpecialStr
Function parameters
Parameters
- buf:[]u8
- f:anytype
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
fn copySpecialStr(buf: []u8, f: anytype) []const u8 {
if (f.sign) {
buf[0] = '-';
}
const offset: usize = @intFromBool(f.sign);
if (f.mantissa != 0) {
@memcpy(buf[offset..][0..3], "nan");
return buf[0 .. 3 + offset];
}
@memcpy(buf[offset..][0..3], "inf");
return buf[0 .. 3 + offset];
}