5
src/builtins/any_num.pir - C<Num>-like functions and methods for C<Any>
9
This file implements the methods and functions of C<Any> that
10
are most closely associated with the C<Num> class or role.
11
We place them here instead of F<src/classes/Any.pir> to keep
12
the size of that file down and to emphasize their generic,
23
.sub 'onload' :anon :init :load
24
$P0 = get_hll_namespace ['Any']
25
'!EXPORT'('int,polar,truncate', 'from'=>$P0)
27
## pre-seed a random number generator
32
.sub 'int' :method :multi(_)
33
"die"("the int() sub and .int method have been replaced by the .Int method")
37
.sub 'Int' :method :multi(_)
38
.tailcall self.'truncate'()
47
.sub 'polar' :method :multi(_)
49
.tailcall 'list'($N0, 0)
59
.param num seed :optional
60
.param int has_seed :opt_flag
61
if has_seed goto have_seed
83
.sub 'truncate' :method :multi(_)
86
if $N0 < 0 goto num_ceil
104
# vim: expandtab shiftwidth=4 ft=pir: