Function sizeInBaseUpperBound [src]

Returns the approximate size of the integer in the given base. Negative values accommodate for the minus sign. This is used for determining the number of characters needed to print the value. It is inexact and may exceed the given value by ~1-2 bytes. TODO See if we can make this exact.

Prototype

pub fn sizeInBaseUpperBound(self: Const, base: usize) usize

Parameters

self: Constbase: usize

Source

pub fn sizeInBaseUpperBound(self: Const, base: usize) usize { const bit_count = @as(usize, @intFromBool(!self.positive)) + self.bitCountAbs(); return (bit_count / math.log2(base)) + 2; }