Go to the first, previous, next, last section, table of contents.

# Floating Point

## Definitions for Floating Point

Function: BFFAC (exp,n)
  BFLOAT version of the Factorial (shifted Gamma) function. The 2nd argument is how many digits to retain and return, it's a good idea to request a couple of extra. This function is available by doing LOAD(BFFAC); .

Variable: ALGEPSILON
  The default value is 10^-8. The value of ALGEPSILON is used by ALGSYS.

Function: BFLOAT (X)
  converts all numbers and functions of numbers to bigfloat numbers. Setting FPPREC[16] to N, sets the bigfloat precision to N digits. If FLOAT2BF[FALSE] is FALSE a warning message is printed when a floating point number is converted into a bigfloat number (since this may lead to loss of precision).

Function: BFLOATP (exp)
  is TRUE if exp is a bigfloat number else FALSE.

Function: BFPSI (n,z,fpprec)
  gives polygammas of real arg and integer order. For digamma, BFPSI0(z,fpprec) is more direct. Note -BFPSI0(1,fpprec) provides BFLOATed %GAMMA. To use this do LOAD(BFFAC);

Variable: BFTORAT
  default: [FALSE] controls the conversion of bfloats to rational numbers. If

      BFTORAT:FALSE

  RATEPSILON will be used to control the conversion (this results in relatively small rational numbers). If

      BFTORAT:TRUE

  , the rational number generated will accurately represent the bfloat.

Variable: BFTRUNC
  default: [TRUE] causes trailing zeroes in non-zero bigfloat numbers not to be displayed. Thus, if BFTRUNC:FALSE, BFLOAT(1); displays as 1.000000000000000B0. Otherwise, this is displayed as 1.0B0.

Function: CBFAC (z,fpprec)
  a factorial for complex bfloats. It may be used by doing LOAD(BFAC); For more details see share2/bfac.usg.

Function: FLOAT (exp)
  converts integers, rational numbers and bigfloats in exp to floating point numbers. It is also an EVFLAG, FLOAT causes non-integral rational numbers and bigfloat numbers to be converted to floating point.

Variable: FLOAT2BF
  default: [FALSE] if FALSE, a warning message is printed when a floating point number is converted into a bigfloat number (since this may lead to loss of precision).

Function: FLOATDEFUNK
  - is a utility for making floating point functions from mathematical expression. It will take the input expression and FLOAT it, then OPTIMIZE it, and then insert MODE_DECLAREations for all the variables. This is THE way to use ROMBERG, PLOT2, INTERPOLATE, etc. e.g. EXP:some-hairy-macsyma-expression;

      FLOATDEFUNK('F,['X],EXP);

  will define the function F(X) for you. (Do PRINTFILE(MCOMPI,DOC,MAXDOC); for more details.)

Function: FLOATNUMP (exp)
  is TRUE if exp is a floating point number else FALSE.

Variable: FPPREC
  default: [16] - Floating Point PRECision. Can be set to an integer representing the desired precision.

Variable: FPPRINTPREC
  default: [0] - The number of digits to print when printing a bigfloat number, making it possible to compute with a large number of digits of precision, but have the answer printed out with a smaller number of digits. If FPPRINTPREC is 0 (the default), or >= FPPREC, then the value of FPPREC controls the number of digits used for printing. However, if FPPRINTPREC has a value between 2 and FPPREC-1, then it controls the number of digits used. (The minimal number of digits used is 2, one to the left of the point and one to the right. The value 1 for FPPRINTPREC is illegal.)

Function: ?ROUND (x,&optional-divisor)
  round the floating point X to the nearest integer. The argument must be a regular system float, not a bigfloat. The ? beginning the name indicates this is normal common lisp function.

      (%i3) ?round(-2.8);
      (%o3) 				      - 3

Function: ?TRUNCATE (x,&optional-divisor)
  truncate the floating point X towards 0, to become an integer. The argument must be a regular system float, not a bigfloat. The ? beginning the name indicates this is normal common lisp function.

    (%i4) ?truncate(-2.8);
    (%o4) 				      - 2
    (%i5) ?truncate(2.4);
    (%o5) 				       2
    (%i6) ?truncate(2.8);
    (%o6) 				       2

Variable: ZUNDERFLOW
  default: [TRUE] - if FALSE, an error will be signaled if floating point underflow occurs. Currently in NIL Macsyma, all floating-point underflow, floating-point overflow, and division-by-zero errors signal errors, and this switch is ignored.

Go to the first, previous, next, last section, table of contents.