Skip to content

IntRootRem

IntRootRem

Description

Compute an integer root and the leftover remainder.

Parameters

Name Direction Description
root out Destination for the root
remainder out Destination for the remainder
value in Input value
degree in Root degree

Usage example (from documentation)

  IntRootRem(&root, &rem, &value, 3);

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void IntRootRem(Int *root, Int *remainder, Int *value, u64 degree) {
        ValidateInt(root);
        ValidateInt(remainder);
        Int remainder = IntInit();
    
        IntRootRem(&root, &remainder, value, degree);
        IntDeinit(&remainder);
        int_replace(result, &root);
    
    void IntSqrtRem(Int *root, Int *remainder, Int *value) {
        IntRootRem(root, remainder, value, 2);
    }
            bool exact    = false;
    
            IntRootRem(&root, &remainder, value, degree);
            exact = IntIsZero(&remainder);
    
    bool test_int_root_rem(void) {
        WriteFmt("Testing IntRootRem\n");
    
        Int value = IntFrom(200);
        Int remainder = IntInit();
    
        IntRootRem(&root, &remainder, &value, 3);
    
        bool result = IntToU64(&root) == 5;
        Int remainder = IntInit();
    
        IntRootRem(&root, &remainder, &value, 0);
        return false;
    }
Last updated on