You are currently viewing the gmlscripts.pro static mirror. Forum access and script submissions are not available through this mirror.

Invert gmlscripts.pro

dec_to_oct

Converts a decimal value to a string of octal digits.

oct = dec_to_oct(123);  //  oct == "173"
oct = dec_to_oct(456);  //  oct == "710"
oct = dec_to_oct(789);  //  oct == "1425"
dec_to_oct(dec)
Returns a string of octal digital (3 bits each) representing the given decimal integer.
COPY/// dec_to_oct(dec)
//
//  Returns a string of octal digital (3 bits each)
//  representing the given decimal integer.
//
//      dec         non-negative integer, real
//
/// gmlscripts.pro/license
{
    var dec, oct, o;
    dec = argument0
    oct = "";
    o = "01234567";
    do {
        oct = string_char_at(o, (dec & 7) + 1) + oct;
        dec = dec >> 3;
    } until (dec == 0);
    return oct;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw