BCX Run-time Math Functions

The following functions return floating point values based upon the values in their arguments. All trigonometric functions use radians for their arguments and return radian values.


 A# = SIN(B)     'A = Sine of B

 A# = COS(B)     'A = Cosine of B

 A# = TAN(B)     'A = Tangent of B

 A# = SINH(B)    'A = Hyperbolic Sine of B

 A# = COSH(B)    'A = Hyperbolic Cosine of B

 A# = TANH(B)    'A = Hyperbolic Tangent of B

 A# = ATN(B)     'A = Arc Tangent of B

 A# = ASIN(B)    'A = Arc Sine of B

 A# = ACOS(B)    'A = Arc Cosine of B

 A# = ATANH(B)   'A = Hyperbolic Arc Tangent of B

 A# = ASINH(B)   'A = Hyperbolic Arc Sine of B

 A# = ACOSH(B)   'A = Hyperbolic Arc Cosine of B

 A# = LOG(B)     'A = natural log(B)

 A# = LOG10(B)   'A = base 10 log(B)

 A# = SQR(B)     'A = Square Root of B

 A# = SQRT(B)    'A = Square Root of B

 A# = POW(B,C)   'A = B raised to the power of C

 A# = HYPOT(B,C) 'A = Hypotenuse of a right triangle

 A# = MOD(B,C)   'A = MODulo(B / C)(floating point)

 A% = IMOD(B,C)  'A = MODulo(B / C)(integer)

 A# = EXP(B)     'A = e(2.718281828459045) raised to power of B

BCX recognizes SINL, COSL, TANL, SQRTL, POWL as returning a LONG DOUBLE.

For example,


 CONST PI = 3.141592653589753
 CONST TR = 57.2957795130831
 PRINT SIN(45/TR)
 PRINT SINL(45/TR)

Result:


 0.70710678118654
 0.7071067811865399563

The Modulus Operator(%)

BCX accepts the C language modulus operator(%) in BASIC expressions. When using the modulus operator(%), a space must be to the left and right of of the %.

CORRECT: WHILE a % b

INCORRECT: WHILE a%b

C Language shortcuts

The following C shortcuts are valid in BASIC code:


 a ++   is equivalent to a = a + 1
 a --   is equivalent to a = a - 1
 a += 2 is equivalent to a = a + 2
 a -= 2 is equivalent to a = a - 2
 a *= 2 is equivalent to a = a * 2
 a /= 2 is equivalent to a = a / 2

Example 1:


 DIM A

 IF ++A > 0 THEN ' Add one to 'A' before performing the test
 PRINT  A        ' This will print the number 1
 END IF

Example 2:


 DIM A

 IF A++ > 0 THEN ' Add one to 'A' after performing the test
  PRINT "Sorry!" ' This will not print
 ELSE
  PRINT "A=",A   ' but this will!
 END IF