Skip to content

FloatTryToStr

Description

Convert a float to a decimal string using the default allocator.

Parameters

Name Direction Description
out out Destination string.
value in Float to convert.

Success

Returns true. *out holds the decimal representation of value (sign, integer part, fractional part).

Failure

Returns false on allocation failure. *out is left in a valid but unspecified state.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool FloatTryToStr(Str *out, Float *value) {
        ValidateFloat(value);
        return FloatTryToStrAlloc(out, value, value->significand.bits.allocator);
        ValidateFloat(value);
    
        if (!FloatTryToStr(&result, value)) {
            result = StrInit(value->significand.bits.allocator);
        }
    
    bool test_float_try_to_str_allocator_inheritance(void) {
        WriteFmt("Testing FloatTryToStr allocator behavior\n");
    
        Float     value = FloatFromStr("-123.45");
Last updated on