Skip to content

FloatFrom

FloatFrom

Description

Convert a numeric value into an arbitrary-precision float. Dispatches on the type of value.

Parameters

Name Direction Description
value in Integer, Int, float, or double source value

Usage example (from documentation)

  Float value = FloatFrom(42);

Returns

Float representing the same numeric value.

Usage example (Cross-references)

Usage examples (Cross-references)
    
    bool test_float_from_unsigned_integer(void) {
        WriteFmt("Testing FloatFrom with unsigned integer\n");
    
        Float value = FloatFrom(42);
        WriteFmt("Testing FloatFrom with unsigned integer\n");
    
        Float value = FloatFrom(42);
        Str   text  = FloatToStr(&value);
    
    bool test_float_from_signed_integer(void) {
        WriteFmt("Testing FloatFrom with signed integer\n");
    
        Float value = FloatFrom(-42);
        WriteFmt("Testing FloatFrom with signed integer\n");
    
        Float value = FloatFrom(-42);
        Str   text  = FloatToStr(&value);
    
    bool test_float_from_int_container(void) {
        WriteFmt("Testing FloatFrom with Int container\n");
    
        Int   integer = IntFromStr("12345678901234567890");
    
        Int   integer = IntFromStr("12345678901234567890");
        Float value   = FloatFrom(&integer);
        Str   text    = FloatToStr(&value);
Last updated on