Skip to content

FloatTryToStr

Description

Convert a float to a decimal string. Two forms via argument count:

  • FloatTryToStr(out, value) - uses value’s allocator.
  • FloatTryToStr(out, value, alloc) - uses the explicit allocator.

Success

Returns true. *out holds the decimal representation.

Failure

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

Usage example (Cross-references)

Usage examples (Cross-references)
        Str   out = StrInit(&dbg.base);
    
        bool ok = FloatTryToStr(&out, &v);
    
        FloatDeinit(&v);
        Str   out = StrInit(&dbg.base);
    
        bool ok = FloatTryToStr(&out, &v);
    
        FloatDeinit(&v);
    
    bool test_float_try_to_str_allocator_inheritance(void) {
        WriteFmt("Testing FloatTryToStr allocator behavior\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
Last updated on