Branch: Tag:

1999-10-19

1999-10-19 22:21:32 by Fredrik Noring <noring@nocrew.org>

Bignum additions: a) small number function call emulation using Gmp, b) intp, c) sprintf %O (describe_svalue), d) sqrt and e) casting from float to integer.

Rev: src/bignum.c:1.4
Rev: src/bignum.h:1.5
Rev: src/builtin_functions.c:1.188
Rev: src/modules/_math/math.c:1.23
Rev: src/opcodes.c:1.44
Rev: src/svalue.c:1.46

8:   #include "svalue.h"   #include "error.h"    -  +    struct svalue auto_bignum_program = { T_INT };      static void resolve_auto_bignum_program(void)
41:    error("Gmp.mpz conversion failed.\n");   }    + int is_bignum_object(struct object *o) + { +  resolve_auto_bignum_program(); +  return o->prog == program_from_function(&auto_bignum_program); + }    -  + int is_bignum_object_in_svalue(struct svalue *sv) + { +  return sv->type == T_OBJECT && is_bignum_object(sv->u.object); + } +    struct object *make_bignum_object(void)   {    convert_stack_top_to_bignum(); -  return (--sp)->u.object; +  return (--sp)->u.object;   }      struct object *bignum_from_svalue(struct svalue *s)   {    push_svalue(s);    convert_stack_top_to_bignum(); -  return (--sp)->u.object; +  return (--sp)->u.object;   }      struct pike_string *string_from_bignum(struct object *o, int base)