smath -  shell scripting tool that allows shell scripts to do real valued arithmetic.

SYNOPSIS

smath  [ parameter=value ... ]  [ inputfile ... ]

 

Parameters are: -r    -d     -f#.

DESCRIPTION

smath is a shell scripting tool that allows shell scripts to do real valued arithmetic. Any emath expression not involving variables, dimensions, or aggregates is allowed.  To ensure the shell does not interpret special characters like ()'s , it is best to put the entire expression in  single or double quotes.  smath 1 + 2  and   smath '1+2'  give the same result (3),  but the second form is safer and preferred.

PARAMETERS

-r
option indicates angles are radians
 
-d
option indicates angles are degrees
 
-f#
means output result using  F format with # decimal places
    

In C, that would be: 

printf("%.*f\n", decimal_places, result); 

if the -f option is not used, then result is output using G format and a
maximum of 10 total digits. In C that would be:  

printf("%.10g\n", result);

EXAMPLES

set LAT = `etxinfo item=center_lat std_format=no $DATASET`
set COS = `smath -d  "cos($LAT)"`

FILES

none

SEE ALSO

emath


Last Updated: $Date: 1999/05/10 20:46:21 $