25   char *ptr = str + len;
 
   47 #define PN_NUM_MATH(math_op) \ 
   48   DBG_CHECK_NUM(self); \ 
   50   if (PN_IS_INT(self) && PN_IS_INT(num)) \ 
   51     return PN_NUM(PN_INT(self) math_op PN_INT(num)); \ 
   52   return potion_double(P, PN_DBL(self) math_op PN_DBL(num)); 
   53 #define PN_INT_MATH(math_op) \ 
   54   DBG_CHECK_INT(self); \ 
   56   return PN_NUM(PN_INT(self) math_op PN_INT(num)); 
   57 #define PN_DBL_MATH(math_op) \ 
   58   DBG_CHECK_NUM(self); \ 
   60   return potion_double(P, PN_DBL(self) math_op PN_DBL(num)); 
  102   int z = (int)(x / y);
 
  189   sprintf(ints, 
"%ld", 
PN_INT(
self));
 
  196 static PN potion_num_number(
Potion *P, 
PN cl, 
PN self) {
 
  202 static PN potion_num_double(
Potion *P, 
PN cl, 
PN self) {
 
  211 static PN potion_num_integer(
Potion *P, 
PN cl, 
PN self) {
 
  243   int len = sprintf(ints, 
"%.16f", ((
struct PNDouble *)
self)->value);
 
  244   while (len > 0 && ints[len - 1] == 
'0') len--;
 
  245   if (ints[len - 1] == 
'.') len++;
 
  255     sprintf(ints, 
"%ld", 
PN_INT(
self));
 
  257     int len = sprintf(ints, 
"%.16f", ((
struct PNDouble *)
self)->value);
 
  258     while (len > 0 && ints[len - 1] == 
'0') len--;
 
  259     if (ints[len - 1] == 
'.') len++;
 
  287     potion_fatal(
"block argument for times is not a closure");
 
  288   for (i = 0; i < j; i++)
 
  306   for (i = j; i != k + s; i += s)
 
  308   return PN_NUM(labs(i - j));
 
  323     potion_fatal(
"block argument for step is not a closure");
 
  324   for (i = 
PN_INT(
self); i <= j; i += k) {
 
  327   return PN_NUM(labs(i - j) / k);
 
  341 static PN potion_num_is_number(
Potion *P, 
PN cl, 
PN self) {
 
  347 static PN potion_num_is_integer(
Potion *P, 
PN cl, 
PN self) {
 
  353 static PN potion_num_is_double(
Potion *P, 
PN cl, 
PN self) {
 
  398     double d1 = ((
struct PNDouble *)
self)->value;
 
  400     return d1 < d2 ? 
PN_NUM(-1) : d1 == d2 ? 
PN_ZERO : PN_NUM(1);
 
  405     return n1 < n2 ? 
PN_NUM(-1) : n1 == n2 ? 
PN_ZERO : PN_NUM(1);
 
  416   double d1 = ((
struct PNDouble *)
self)->value;
 
  486   potion_method(num_vt, 
"step", potion_int_step, 
"end=N,step=N,block=&");
 
PN potion_num_string(Potion *, PN, PN)
 
PN potion_str(Potion *, const char *)
 
PN potion_double(Potion *P, double v)
new PNDouble (double) 
 
#define PN_ALLOC_N(V, T, C)
 
static PN potion_dbl_div(Potion *P, PN cl, PN self, PN num)
 
#define PN_INT_MATH(math_op)
 
static PN potion_dbl_mult(Potion *P, PN cl, PN self, PN num)
 
#define potion_method(RCV, MSG, FN, SIG)
 
static PN potion_dbl_add(Potion *P, PN cl, PN self, PN num)
 
void potion_num_init(Potion *P)
 
static PN potion_dbl_sub(Potion *P, PN cl, PN self, PN num)
 
PN potion_num_pow(Potion *, PN, PN, PN)
 
static PN potion_int_abs(Potion *P, PN cl, PN self)
 
PN potion_num_rand(Potion *P, PN cl, PN self)
 
static PN potion_int_mult(Potion *P, PN cl, PN self, PN num)
 
#define DBG_CHECK_DBL(obj)
 
static PN potion_int_div(Potion *P, PN cl, PN self, PN num)
 
#define DBG_CHECK_INT(obj)
 
static PN potion_int_cmp(Potion *P, PN cl, PN self, PN n)
 
PN potion_strtod(Potion *P, char *str, int len)
Convert string to double. 
 
#define PN_CHECK_INT(obj)
 
#define DBG_CHECK_NUM(obj)
 
static PN potion_int_bitr(Potion *P, PN cl, PN self, PN num)
 
the global interpreter state P. currently singleton (not threads yet) 
 
PN potion_int_string(Potion *P, PN cl, PN self)
 
#define PN_CHECK_NUM(obj)
 
#define PN_NUM_MATH(math_op)
 
static PN potion_int_bitn(Potion *P, PN cl, PN self)
 
#define potion_send(RCV, MSG, ARGS...)
method caches (more great stuff from ian piumarta) 
 
doubles are floating point numbers stored as binary data. 
 
static PN potion_dbl_abs(Potion *P, PN cl, PN self)
 
static PN potion_int_sub(Potion *P, PN cl, PN self, PN num)
 
static PN potion_dbl_cmp(Potion *P, PN cl, PN self, PN n)
 
static PN potion_int_add(Potion *P, PN cl, PN self, PN num)
 
void potion_fatal(char *message)
 
#define PN_DBL_MATH(math_op)
 
static PN potion_int_bitl(Potion *P, PN cl, PN self, PN num)
 
PN potion_dbl_string(Potion *P, PN cl, PN self)