SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

6.2.10 DEG(num_expr)

Given an angle in radians, the DEG function returns the number of degrees.

Example 6-24 DEG function

  print deg(14) 
  
  
802.140913183152502 

6.2.11 EXP(num_expr)

EXP function returns the value of the mathematical constant, "e", raised to a specified power.

Example 6-25 EXP function

  print exp(5) 
  
  
148.413159102577 

6.2.12 LOG(num_expr)

LOG returns the natural logarithm of a specified number.

Example 6-26 LOG function

  print log(100) 
  
  
4.605170186 

6.2.13 LOG2(num_expr)

LOG2 returns a number's base 2 logarithm.

Example 6-27 LOG2 function

  print log2(100) 
  
  
6.643856189775 

6.2.14 LOG10(num_expr)

LOG10 returns a number's common logarithm.

Example 6-28 LOG10 function

  print log10(100) 
  
  
2 

6.2.15 PI

Returns the value 3.1415926535897932.

Example 6-29 PI function

  print pi
  
  
3.1415926535897932 

6.2.16 RAD(num_expr)

Given a measurement in degrees, the RAD function returns the number of radians.

Example 6-30 RAD function

  print rad(85) 
  
  
1.4835298641951801 

6.2.17 SEC(num_expr)

SEC returns a secant of a given angle (1/COS(num_expr)). num_expr is a passed angle.

Example 6-31 SEC function

  print sec(5) 
  
  
3.5253200858189003 

6.2.18 SGN(num_expr)

SGN returns the sign of a number. It returns a +1 if the expression is positive, a -1 if the expression is negative, and 0 if the expression is zero.

Example 6-32 SGN function

  print sgn(-238) 
  print sgn(238) 
  print sgn(0) 
  
-1 
 1 
 0 

6.2.19 SIN(num_expr)

SIN returns the sine of an angle specified in radians.

Example 6-33 SIN function

  print sin(23) 
  
  
-.846220404 

6.2.20 SINH(num_expr)

SINH(X) returns the hyperbolic sine X.

Example 6-34 SINH function

  print sinh(23) 
  
  
4872401723.124451637268 

6.2.21 SQR(num_expr)

SQR returns the square root of a number.

Example 6-35 SQR function

  print sqr(64) 
  
  
8 

6.2.22 TAN(num_expr)

TAN returns the tangent of an angle that is specified in radians.

Example 6-36 TAN function

  print tan(0.2) 
  
  
 .202710035509 

6.2.23 TANH(num_expr)

TANH returns the hyperbolic tangent of the numeric expression given.

Example 6-37 TANH function

  print tanh(0.5) 
  
  
 .46211715726 

6.3 Date and Time Functions

The following are date and time functions that SheerPower performs:

6.3.1 DATE

DATE returns today's date in YYDDD format. The 'DDD' is the number of days that have gone by so far this year.

Example 6-38 DATE function

  print date
  
  
3117 

6.3.2 DATE$[(int_expr1, [int_expr2])]

The DATE$ function returns the date in image format. int_expr1 is a given Julian day number, the default is today's date. int_expr2 indicates the desired output format for the date. The Julian day is the number of days since January 1, 1600.

Table 6-1 DATE$ function - integer values
Value (int_expr2) Output Date Format
0 YYYYMMDD format
1 MMDDYYYY format
2 DDMMYYYY format
3 dd-Mon-yyyy format
4 Month dd, yyyy format

Example 6-39 DATE$ function

  print date$                 -  gives 20010424 
  
  print date$(days(date$),1)  -  gives 04242001 
  
  print date$(days(date$),2)  -  gives 24042001 
   
  print date$(days(date$),3)  -  gives 24-Apr-2001 
  
  print date$(days(date$),4)  -  gives April 20, 2001       

6.3.3 DAYS(str_expr [, int_num])

Given a date in CCYYMMDD or YYMMDD format, the DAYS function returns the number of days since January 1, 1600 (this date is day 1). This number is called the Julian day.

Example 6-40 DAYS function

  print days('20000122') 
  print days('990122') 
  end
 
 
146119 
145754 

int_num indicates the desired input format for the date. The default input format is zero. If the century is not included, it assumes 1900 as the century.

Table 6-2 DAYS function - integer values
Value (int_num) Input Date Format
0 CCYYMMDD or YYMMDD
1 MMDDCCYY or MMDDYY
2 DDMMCCYY or DDMMYY
3 DD-Mon-CCYY or DD-Mon-YY
4 Month DD, CCYY

Example 6-41 DAYS function - integer values

  print days('20000103',0) 
  print days('01032000',1) 
  print days('03012000',2) 
  print days('03-Jan-2000',3) 
  print days('January 3, 2000',4) 
  end
 
 
146100 
146100 
146100 
146100 
146100 

6.3.4 DAY$[(int_expr)]

Given an integer expression specifying the number of days since January 1, 1600, DAY$ returns the day of the week. If no integer expression is given, DAY$ returns the day of the week for today's date. The day is returned as a string expression (Friday, Saturday, etc.).

Example 6-42 DAY$ function

  print day$
 
 
Saturday 

6.3.5 FULLTIME$[(float_expr, [int_var])]

Given the number of seconds since the SheerPower base date, the FULLTIME$ function returns the date and time in one of the formats given below.

float_expr is the number of seconds since the SheerPower base date. The default is the current date and time. January 1, 1600 00:00:00 is considered the second 0.

Table 6-3 FULLTIME$ function - integer values
Value (int_var) Output Data Format
0 CCYYMDD HHMMSS
1 MMDDCCYY HHMMSS
2 DDMMCCYY HHMMSS
3 DD-Mon-CCYY HH:MM:SS
4 Month DD, CCYY HH:MM:SS

Example 6-43 FULLTIME$ function

  print fulltime$
  sec = seconds('20000121 115042') 
  print fulltime$(sec, 0) 
  print fulltime$(sec, 1) 
  print fulltime$(sec, 2) 
  print fulltime$(sec, 3) 
  print fulltime$(sec, 4) 
  end
 
 
20000208 232653 
20000121 115042 
01212000 115042 
21012000 115042 
21-Jan-2000 11:50:42 
January 21, 2000 11:50:42 


Previous Next Contents Index