Previous Page Next Page Contents

generate::Macrofort::setPrecisionOption -- sets precision

Introduction

Mac::setPrecisionOption (where Mac:=generate::Macrofort) sets the precision (single, double or quadruple) for the FORTRAN code generated by Mac::genFor.

Call(s)

generate::Macrofort::setPrecisionOption(s)

Parameters

s - one of the strings "single", "double" or "quadruple".

Returns

the void object of domain type DOM_NULL

Side Effects

Resets the global macrofort precision variable for the FORTRAN code generated by generate::Macrofort::genFor.

Related Functions

DIGITS, generate::Macrofort::init, generate::Macrofort::genFor

Details

Example 1

Initialize Macrofort and open file "test.f"

>> Mac := generate::Macrofort:
   Mac::init():
   Mac::openOutputFile("test.f"):

This example generates the same FORTRAN assignment in respectively single, double and quadruple precisions.

>> Mac::setPrecisionOption("single"):
   Mac::genFor(["equal", a, 1.0 + PI*sinh(E)]):
   Mac::setPrecisionOption("double"):
   Mac::genFor(["equal", a, 1.0 + PI*sinh(E)]):
   Mac::setPrecisionOption("quadruple"):
   Mac::genFor(["equal", a, 1.0 + PI*sinh(E)]):
   Mac::closeOutputFile():
   delete a:

The output file test.f is:

            a = 0.3141593E1*sinh(0.2718282E1)+0.1E1
            a = 0.3141592653589793D1*dsinh(0.2718281828459045D1)+0.1D1
            a = 0.31415926535897932384626433832795Q1*qsinh(0.27182818284590452
           #353602874713527Q1)+0.1Q1

See the help-file for Mac::genFor for a more comprehensive list of examples.




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000