p2  0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PNInteger Class Reference

Either a PN_INT immediate object (no struct) 0x...1 Integer: 31bit/63bit shifted off the last 1 bit or a PNDouble double. More...

#include <potion.h>

Public Member Functions

PN potion_num_rand (Potion *P, PN cl, PN self)
 
static PN potion_int_add (Potion *P, PN cl, PN self, PN num)
 
static PN potion_int_sub (Potion *P, PN cl, PN self, PN num)
 
static PN potion_int_mult (Potion *P, PN cl, PN self, PN num)
 
static PN potion_int_div (Potion *P, PN cl, PN self, PN num)
 
static PN potion_int_bitn (Potion *P, PN cl, PN self)
 
static PN potion_int_bitl (Potion *P, PN cl, PN self, PN num)
 
static PN potion_int_bitr (Potion *P, PN cl, PN self, PN num)
 
PN potion_int_string (Potion *P, PN cl, PN self)
 
static PN potion_int_abs (Potion *P, PN cl, PN self)
 
static PN potion_int_cmp (Potion *P, PN cl, PN self, PN n)
 

Detailed Description

Either a PN_INT immediate object (no struct) 0x...1 Integer: 31bit/63bit shifted off the last 1 bit or a PNDouble double.

See also
PN_NUM (int to obj), PN_INT (obj to int), PN_IS_INT (is num obj?)

Member Function Documentation

PN potion_num_rand ( Potion P,
PN  cl,
PN  self 
)

"rand" generate random float number

1 rand #=> 0.xxxxxx
Returns
PNDouble in [0.0,0.1]-interval
See also
potion_rand for long, potion_srand.

Definition at line 182 of file mt19937ar.c.

static PN potion_int_add ( Potion P,
PN  cl,
PN  self,
PN  num 
)

"+" method

Parameters
numPNInteger
Returns
PNInteger

Definition at line 139 of file number.c.

static PN potion_int_sub ( Potion P,
PN  cl,
PN  self,
PN  num 
)

"-" method

Parameters
numPNInteger
Returns
PNInteger

Definition at line 144 of file number.c.

static PN potion_int_mult ( Potion P,
PN  cl,
PN  self,
PN  num 
)

"*" method

Parameters
numPNInteger
Returns
PNInteger

Definition at line 149 of file number.c.

static PN potion_int_div ( Potion P,
PN  cl,
PN  self,
PN  num 
)

"/" method

Parameters
numPNInteger
Returns
PNInteger

Definition at line 154 of file number.c.

static PN potion_int_bitn ( Potion P,
PN  cl,
PN  self 
)

"~" method, bitwise negation

~ 0 #=> -1
Returns
PNInteger

Definition at line 165 of file number.c.

static PN potion_int_bitl ( Potion P,
PN  cl,
PN  self,
PN  num 
)

"<<" method, left shift by num.

2 << 1 #=> 4
Parameters
numPNInteger
Returns
PNInteger

Definition at line 173 of file number.c.

static PN potion_int_bitr ( Potion P,
PN  cl,
PN  self,
PN  num 
)

">>" method, right shift by num.

4 >> 1 #=> 2
Parameters
numPNInteger
Returns
PNInteger

Definition at line 181 of file number.c.

PN potion_int_string ( Potion P,
PN  cl,
PN  self 
)

"string" method, stringify

Returns
PNString

Definition at line 187 of file number.c.

static PN potion_int_abs ( Potion P,
PN  cl,
PN  self 
)

"abs"

Returns
PNInteger

Definition at line 373 of file number.c.

static PN potion_int_cmp ( Potion P,
PN  cl,
PN  self,
PN  n 
)

"cmp" a number to a value. casts argument n to a number

1 cmp 2 #=> -1
1 cmp 1 #=> 0
1 cmp 0 #=> 1
Parameters
nPN number compared to
Returns
PNInteger -1, 0 or 1
See also
potion_tuple_sort.

Definition at line 430 of file number.c.


The documentation for this class was generated from the following files: