[previous] [up] [next]     [contents] [index]
Next: Ports and the Filesystem Up: BignumsRationals, and Complex Previous: BignumsRationals, and Complex

Library Functions

int scheme_is_exact(Scheme_Object *n) 

Returns 1 if n is an exact number, 0 otherwise (n need not be a number).

int scheme_is_inexact(Scheme_Object *n) 

Returns 1 if n is an inexact number, 0 otherwise (n need not be a number).

Scheme_Object *scheme_make_bignum(long v) 

Creates a bignum representing the integer v. This can create a bignum that otherwise fits into a fixnum. This must only be used to create temporary values for use with the bignum functions. Final results can be normalized with scheme_bignum_normalize. Only normalized numbers can be used with procedures that are not specific to bignums.

Scheme_Object *scheme_make_bignum_from_unsigned(unsigned long v) 

Like scheme_make_bignum, but works on unsigned integers.

double scheme_bignum_to_double(Scheme_Object *n) 

Converts a bignum to a floating-point number, with reasonable but unspecified accuracy.

float scheme_bignum_to_float(Scheme_Object *n) 

If MzScheme is not compiled with single-precision floats, this procedure is actually a macro alias for scheme_bignum_to_double.

Scheme_Object *scheme_bignum_from_double(double d) 

Creates a bignum that is close in magnitude to the floating-point number d. The conversion accuracy is reasonable but unspecified.

Scheme_Object *scheme_bignum_from_float(float f) 

If MzScheme is not compiled with single-precision floats, this procedure is actually a macro alias for scheme_bignum_from_double.

char *scheme_bignum_to_string(Scheme_Object *n, int radix) 

Writes a bignum into a newly allocated string.

Scheme_Object *scheme_read_bignum(char *str, int radix) 

Reads a bignum from a string. If the string does not represent an integer, then NULL will be returned. If the string represents a number that fits in 31 bits, then a scheme_integer_type object will be returned.

Scheme_Object *scheme_bignum_normalize(Scheme_Object *n) 

If n fits in 31 bits, then a scheme_integer_type object will be returned. Otherwise, n is returned.

Scheme_Object *scheme_make_rational(Scheme_Object *r, Scheme_Object *d) 

Creates a rational from a numerator and denominator. The n and d parameters must be fixnums or bignums (possibly mixed). The resulting will be normalized (thus, an bignum or fixnum might be returned).

double scheme_rational_to_double(Scheme_Object *n) 

Converts the rational n to a double.

float scheme_rational_to_float(Scheme_Object *n) 

If MzScheme is not compiled with single-precision floats, this procedure is actually a macro alias for scheme_rational_to_double.

Scheme_Object *scheme_rational_numerator(Scheme_Object *n) 

Returns the numerator of the rational n.

Scheme_Object *scheme_rational_denominator(Scheme_Object *n) 

Returns the denominator of the rational n.

Scheme_Object *scheme_rational_from_double(double d) 

Converts the given double into a maximally-precise rational.

Scheme_Object *scheme_rational_from_float(float d) 

If MzScheme is not compiled with single-precision floats, this procedure is actually a macro alias for scheme_rational_from_double.

Scheme_Object *scheme_make_complex(Scheme_Object *r, Scheme_Object *i) 

Creates a complex number from real and imaginary parts. The r and i arguments must be fixnums, bignums, flonums, or rationals (possibly mixed). The resulting number will be normalized (thus, a real number might be returned).

Scheme_Object *scheme_complex_real_part(Scheme_Object *n) 

Returns the real part of the complex number n.

Scheme_Object *scheme_complex_imaginary_part(Scheme_Object *n) 

Returns the imaginary part of the complex number n.


[previous] [up] [next]     [contents] [index]
Next: Ports and the Filesystem Up: BignumsRationals, and Complex Previous: BignumsRationals, and Complex

PLT