Skip to content

IntRoot

IntRoot

Description

Compute the integer degree-th root of a value.

Parameters

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

Usage example (from documentation)

  IntRoot(&root, &value, 3);

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void IntRoot(Int *result, Int *value, u64 degree) {
        Int root      = IntInit();
        Int remainder = IntInit();
    
    void IntSqrt(Int *result, Int *value) {
        IntRoot(result, value, 2);
    }
    
    bool test_int_root(void) {
        WriteFmt("Testing IntRoot\n");
    
        Int value = IntFrom(4096);
        Int result_value = IntInit();
    
        IntRoot(&result_value, &value, 4);
    
        bool result = IntToU64(&result_value) == 8;
    
    bool test_int_root_zero_degree(void) {
        WriteFmt("Testing IntRoot zero-degree handling\n");
    
        Int value = IntFrom(16);
Last updated on