big.bend checks
raw source on the hub · import bend-float64@0.1.1.0/big.bend as Big
bend-float64's unbounded natural numbers, for exact decimal conversion: a list of U32 limbs, least significant first, with no zero limb at the top (0 is the empty list). Add, subtract, compare, multiply by a word or a power of ten, shift by bits, bit length, and the top 64 bits with a sticky bit for the rest. Pure.
2 imports
import Base import ./wide.bend as W
Types
type Top source · line 219 · raw
Data
the top 64 bits of a nonzero xs as a W64 whose lowest bit also records whether any bit below them was set, and how far they were shifted down (0 when xs has 64 bits or fewer)
Top@sig:0xc79d53e63a861f09e47e3c6bed94db51/wide.W64 -> @shift:U32 -> Top
Definitions
def cons_trim source · line 9 · raw
@+x:U32 -> @t:List<&2, U32> -> List<&2, U32>
def trim source · line 17 · raw
@xs:List<&2, U32> -> List<&2, U32>
drop zero limbs at the top
def of_u32 source · line 24 · raw
@+x:U32 -> List<&2, U32>
def of_w64 source · line 27 · raw
@x:0xc79d53e63a861f09e47e3c6bed94db51/wide.W64 -> List<&2, U32>
def is_zero source · line 32 · raw
@xs:List<&2, U32> -> Bool
def add_go source · line 41 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> @+c:U32 -> List<&2, U32>
def add source · line 56 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> List<&2, U32>
def sub_go source · line 59 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> @+b:U32 -> List<&2, U32>
def sub source · line 70 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> List<&2, U32>
xs - ys, for xs >= ys
def cmp_top source · line 73 · raw
@rest:Cmp -> @+x:U32 -> @+y:U32 -> Cmp
def cmp source · line 83 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> Cmp
compares limb by limb from the top (a missing limb counts as 0)
def lt source · line 94 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> Bool
def le source · line 97 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> Bool
def mul_small_go source · line 102 · raw
@xs:List<&2, U32> -> @+m:U32 -> @+c:U32 -> List<&2, U32>
def mul_small source · line 112 · raw
@xs:List<&2, U32> -> @+m:U32 -> List<&2, U32>
xs * m
def mul_pow10_go source · line 115 · raw
@n:Nat -> @+xs:List<&2, U32> -> List<&2, U32>
def pow10_small source · line 122 · raw
@+r:U32 -> U32
def mul_pow10 source · line 128 · raw
@xs:List<&2, U32> -> @+n:U32 -> List<&2, U32>
xs * 10^n
def pow10 source · line 131 · raw
@+n:U32 -> List<&2, U32>
def zeros source · line 136 · raw
@n:Nat -> @xs:List<&2, U32> -> List<&2, U32>
def shl_bits source · line 143 · raw
@xs:List<&2, U32> -> @+k:U32 -> @+c:U32 -> List<&2, U32>
def shl source · line 151 · raw
@xs:List<&2, U32> -> @+n:U32 -> List<&2, U32>
xs * 2^n
def drop source · line 154 · raw
@n:Nat -> @xs:List<&2, U32> -> List<&2, U32>
def take source · line 163 · raw
@n:Nat -> @xs:List<&2, U32> -> List<&2, U32>
def head0 source · line 172 · raw
@xs:List<&2, U32> -> U32
def shr_bits source · line 179 · raw
@xs:List<&2, U32> -> @+k:U32 -> List<&2, U32>
def shr source · line 187 · raw
@xs:List<&2, U32> -> @+n:U32 -> List<&2, U32>
xs / 2^n rounded down
def low_nonzero source · line 191 · raw
@+xs:List<&2, U32> -> @+n:U32 -> Bool
whether any of the n lowest bits of xs is set
def bitlen_go source · line 197 · raw
@xs:List<&2, U32> -> @+acc:U32 -> U32
def bitlen source · line 207 · raw
@xs:List<&2, U32> -> U32
the number of bits, 0 for 0
def w64_of source · line 210 · raw
@xs:List<&2, U32> -> 0xc79d53e63a861f09e47e3c6bed94db51/wide.W64
def top64_at source · line 222 · raw
@+xs:List<&2, U32> -> @+k:U32 -> Top
def top64_go source · line 225 · raw
@long:Bool -> @+xs:List<&2, U32> -> @+n:U32 -> Top
def top64 source · line 232 · raw
@+xs:List<&2, U32> -> Top
def mul10 source · line 237 · raw
@+xs:List<&2, U32> -> List<&2, U32>
xs * 10, as xs * 8 + xs * 2, by doubling (additions only)