Skip to content

FloatNegate

Description

Negate a floating-point value in place.

Zero remains non-negative after normalization.

Parameters

Name Direction Description
value in,out Float to modify

Usage example (from documentation)

  FloatNegate(&value);

Success

Returns to the caller. The sign of *value is flipped unless *value is zero, which stays non-negative. Significand and exponent are unchanged.

Failure

Function cannot fail.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void FloatNegate(Float *value) {
        ValidateFloat(value);
            return false;
        }
        FloatNegate(&rhs);
        bool ok = float_add(result, a, &rhs);
        FloatDeinit(&rhs);
    
    bool test_float_negate_abs(void) {
        WriteFmt("Testing FloatNegate and FloatAbs\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        Str   text  = StrInit(&alloc.base);
    
        FloatNegate(&value);
        text = FloatToStr(&value);
Last updated on