Floating-Slash Routines

In these routines a big parameter can also be used wherever a flash is specified, but not visa-versa. Further information may be gleaned from the (lightly) commented source code. An asterisk after the name indicates that the function does not take a mip parameter if MR_GENERIC_MT is defined in mirdef.h .

Function:

void build(x,gener)

flash x;

int (*gener)();
Module Description Parameters Return value
mrbuild.c Uses supplied generator of regular continued fraction expansion to build up a flash number x, rounded if necessary. The flash number created, and the generator function. None

Example:

int phi(w,n)

flash w;

int n;

{ /* rcf generator for golden ratio */

    return 1;

}

...

...

build(x,phi);

...

        This will calculate the golden ratio (1+Ö5)/2 in x - very quickly!

Function:

void dconv(d,x)

double d;

flash x;
Module Description Parameters Return value
mrflash.c Converts a double to flash format. A double d and a flash variable x. On exit x will contain the flash equivalent of d. None

Function:

void denom(x,y)

flash x;

big y;
Module Description Parameters Return value Restrictions
mrore.c Extract the denominator of a flash number A flash number x and a big number y. On exit y will contain the denominator of x. None None

Function:

void facos(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh3.c Calculates arc-cosine of a flash number, using fasin. Two flash numbers x and y. On exit y=arccos(x). None [absolute value of] x must be less than or equal to 1.

Function:

void facosh(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh4.c Calculates hyperbolic arc-cosine of a flash number. Two flash numbers x and y. On exit y=arccosh(x). None [absolute value of] x must be greater than or equal to 1.

Function:

void fadd(x,y,z)

flash x,y,z;
Module Description Parameters Return value Restrictions
mrflash.c Add two flash numbers. Three flash numbers x, y and z. On exit z=x+y. None None

Function:

void fasin(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh3.c Calculates arc-sin of a flash number, using fatan. Two flash numbers x and y. On exit y=arcsin(x). None [absolute value of] x must be less than or equal to 1.

Function:

void fasinh(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh4.c Calculates hyperbolic arc-sin of a flash number. Two flash numbers x and y. On exit y=arcsinh(x). None

Function:

void fatan(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh3.c Calculates the arc-tangent of a flash number, using O(n2.5)method based on Newton's iteration. Two flash numbers x and y. On exit y=arctan(x). None

Function:

void fatanh(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh4.c Calculates the hyperbolic arc-tangent of a flash number. Two flash numbers x and y. On exit y=arctanh(x). None x2 must be less than 1

Function:

int fcomp(x,y)

flash x,y;
Module Description Parameters Return value
mrflash.c Compare two flash numbers. Two flash numbers x and y. Returns -1 if y>x, +1 if x>y and 0 if x=y.

Function:

void fconv(n,d,x)

int n,d;

flash x;
Module Description Parameters Return value Restrictions
mrflash.c Convert a simple fraction to flash format. Integers n and d, and a flash number x. On exit x=n/d None

Function:

void fcos(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh3.c Calculates cosine of a given flash angle, using ftan. Two flash numbers x and y. On exit y=cos(x). None None

Function:

void fcosh(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh4.c Calculates hyperbolic cosine of a given flash angle. Two flash numbers x and y. On exit y=cosh(x). None

Function:

void fdiv(x,y,z)

flash x,y,z;
Module Description Parameters Return value
mrflash.c Divides two flash numbers. Three big numbers x, y and z. On exit z=x/y. None

Function:

double fdsize(x)

flash x;
Module Description Parameters Return value Restrictions
mrdouble.c Converts a flash number to double format. A flash number x. The value of the parameter x as a double. The value of x must be representable as a double.

Function:

void fexp(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh2.c Calculates the exponential of a flash number using O(n2.5) method. Two flash numbers x and y. On exit y=ex. None None

Function:

void fincr(x,n,d,y)

big x,y;

int n,d;
Module Description Parameters Return value Restrictions
mrflash.c Add a simple fraction to a flash number. Two flash numbers x and y, and two integers n and d. On exit . None None

Example:

fincr(x,-2,3,x);|  /* This subtracts two-thirds from the value of x. */

Function:

void flog(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh2.c Calculates the natural log of a flash number using O(n2.5) method. Two flash numbers x and y. On exit y=log(x). None None

Function:

void flop(x,y,op,z)

flash x,y,z;

int *op;
Module Description Parameters Return value Restrictions
mrflash.c Perform primitive flash operation. Used internally. Three flash numbers x, y and z. On exit z=Fn(x,y), where the function performed depends on the parameter op. See source listing comments for more details. None None

Function:

void fmodulo(x,y,z)

flash x,y,z;
Module Description Parameters Return value Restrictions
mrflash.c Find the remainder when one flash number is divided by another. Three flash numbers x, y and z. On exit z=x mod y; None None

Function:

void fmul(x,y,z)

flash x,y,z;
Module Description Parameters Return value Restrictions
mrflash.c Multiply two flash numbers. Three flash numbers x, y and z. On exit z=x.y None None

Function:

void fpack(n,d,x)

flash x;

big n,d;
Module Description Parameters Return value Restrictions
mrore.c Forms a flash number from big numerator and denominator. A flash number x and two big numbers n and d. On exit. None The denominator must be non-zero. Flash variable x and big variable d must be distinct. The resulting flash variable must not be too big for the representation.

Function:

void fpi(x)

flash x;
Module Description Parameters Return value Restrictions
mrpi.c Calculates p using Guass-Legendre O(n2.log n) method. Note that on subsequent calls to this routine, p is immediately available, as it is stored internally. (This routine is disappointingly slow. There appears to be no simple way to calculate a rational approximation to p quickly). A flash number x. On exit x=p. None None. Internally allocated memory is freed when the current MIRACL instance is ended by a call to mirexit.

Function:

void fpmul(x,n,d,y)

flash x,y;

int n,d;
Module Description Parameters Return value Restrictions
mrflash.c Multiplies a flash number by a simple fraction. Two flash numbers x and y, and two integers n and d. On exit None None

Function:

void fpower(x,n,y)

flash x,y;

int n;
Module Description Parameters Return value Restrictions
mrflsh1.c Raises a flash number to an integer power. Flash variables x and y, and an integer n. On exit y=xn. None

Function:

void fpowf(x,y,z)

flash x,y,z;
Module Description Parameters Return value
mrflsh2.c Raises a flash number to a flash power. Three flash numbers x, y and z. On exit z=xy None

Function:

void frand(x)

flash x;
Module Description Parameters Return value
mrfrnd.c Generates a random flash number. A big number x. On exit x contains a flash random number in the range 0<x<1. None

Function:

void frecip (x,y)

flash x,y;
Module Description Parameters Return value
mrflash.c Calculates reciprocal of a flash number. Two flash numbers x and y. On exit y=1/x. None

Function:

BOOL froot(x,m,y)

flash x,y;

int m;
Module Description Parameters Return value Restrictions
mrflsh1.c Calculates m-th root of a flash number using Newton's O(n2) method. Flash numbers x and y, and an integer m. On exit y is the m-th root of x. TRUE for exact root, otherwise FALSE

Function:

void fsin(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh3.c Calculates sine of a given flash angle. Uses ftan. Two flash numbers x and y. On exit y=sin(x). None

Function:

void fsinh(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh4.c Calculates hyperbolic sine of a given flash angle. Two flash numbers x and y. On exit y=sinh(x). None

Function:

void fsub(x,y,z)

flash x,y,z;
Module Description Parameters Return value Restrictions
mrflash.c Subtract two flash numbers. Three flash numbers x, y and z. On exit z=x-y. None

Function:

void ftan(x,y)

flash x,y;
Module Description Parameters Return value
mrflsh3.c Calculates the tan of a given flash angle, using an O(n2.5) method. Two flash numbers x and y. On exit y=tan(x). None

Function:

void ftanh(x,y)

flash x,y;
Module Description Parameters Return value Restrictions
mrflsh4.c Calculates the hyperbolic tan of a given flash angle. Two flash numbers x and y. On exit y=tanh(x). None None

Function:

void ftrunc(x,y,z)

flash x,z;

big y;
Module Description Parameters Return value Restrictions
mrflash.c Separates a flash number to a big number and a flash remainder. Flash numbers x and z, and a big number y. On exit y=int(x) and z is the fractional remainder. If y is the same as z, only int(x) is returned. None None

Function:

void numer(x,y)

flash x;

big y;
Module Description Parameters Return value Restrictions
mrore.c Extract the numerator of a flash number. A flash number x and a big number y. On exit y will contain the numerator of x. None None

Function:

void mround(n,d,x)

flash x;

big n,d;
Module Description Parameters Return value Restrictions
mrround.c Forms a rounded flash number from big numerator and denominator. If rounding takes place the instance variable EXACT is set to FALSE. EXACT is initialised to TRUE in routine mirsys. This routine is used internally. A flash number x and two big numbers n and d. On exit x=R{n/d}, that is the flash number n/d rounded if necessary to fit the representation. None The denominator must be non-zero.