IB enhancements for Comet32
From CometWiki
(Difference between revisions)
		
		
| (11 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | [[IB_Statements/SearchFile|'''Search File''']]  | + | [[IB_Statements/SearchFile|'''Search File - C32''']]  | 
| - | + | [[IB_Statements/InputFile_and_PrintFile|'''InputFile and PrintFile - C32''']]  | |
| - | '''  | + | |
| - | '''  | + | [[IB_Statements/GetFormat|'''GetFormat and SetFormat - C32''']]  | 
| - | + | [[IB_Statements/UserDefinedProcs|'''User Defined Procedures''']]  | |
| - | :  | + | Comet32 Numeric Processing  | 
| - | + | * Comet32 provides much enhanced numeric handling over Comet16.  | |
| - | + | * Numeric variables can be as long as 32 decimal places. This is twice the length of Comet16.  | |
| - | + | * Expression results are calculated to length 64.32 so that partial results of expressions are preserved.  | |
| - | :  | + | * The following Comet16 Functionality is supported::  | 
| - | + |             Add,           z = x + y  | |
| - | + |             Subtract,      z = x - y  | |
| - | + |             Multiply,      z = x * y  | |
| - | + |             Divide,        z = x / y  | |
| - | + |             Negate,        z = - x  | |
| - | + |             Abs,           z = abs(x)      -- Return the absolute value of x  | |
| - | + |             Int,           z = int(x)      -- Return the integer portion of x  | |
| - | + |             Fpt,           z = fpt(x)      -- Return the fractional portion of x  | |
| + |             Sgn,           z = sgn(x)      -- Return the sign of x (-1,0,+1)  | ||
| + |             Num,           z = num(a$,err) -- Return the string a$ converted to a number.  | ||
| + |             Asc,           z = asc(a$)     -- Return the ascii equivalent of the first character in a$.  | ||
| + |             Len,           z = len(a$)     -- Return the length of string a$.  | ||
| + |             BitwiseAnd,    z = x and y  | ||
| + |             BitwiseOr,     z = x or y  | ||
| + |             BitwiseXor,    z = x xor y  | ||
| + |             BitwiseNot,    z = not(x)  | ||
| + |             Mod,           z = x mod y     -- Divides int(x) by int(y) and return the remainder  | ||
| + |             Sqrt,          z = sqrt(x)     -- Return the Square Root of x  | ||
| + |             Rnd,           z = rnd()       -- Return a "random number" between 0 and 1  | ||
| + | Many additional math functions are supported in Comet32:  | ||
| + |             Cbrt,          z = cbrt(x)     -- Return the Cube Root of x  | ||
| + |             Log,           z = log(x)      -- Return the base-e logarithm of x, so x==exp(z)  | ||
| + |             Log10,         z = log10(x)    -- Return the base-10 logarithm of x, so x==pow(10,z)  | ||
| + |             Exp,           z = exp(x)      -- Return e raised to the power x, so x==log(z)  | ||
| + |             Pow,           z = pow(x,y)    -- Return x raised to the power y  | ||
| + |             Sin,           z = sin(x)      -- Return the sine of x, with x in radians  | ||
| + |             Cos,           z = cos(x)      -- Return the cosine of x, with x in radians  | ||
| + |             Tan,           z = tan(x)      -- Return the tangent of x, with x in radians  | ||
| + |             Asin,          z = asin(x)     -- Return the inverse sine of x, in radians  | ||
| + |             Acos,          z = acos(x)     -- Return the inverse cosine of x, in radians  | ||
| + |             Atan,          z = atan(x)     -- Return the inverse tangent of x, in radians  | ||
| + |             Atan2,         z = atan2(y,x)  -- Return the 4 quadrant inverse tangent of y/x  | ||
| + |             Sinh,          z = sinh(x)     -- Return the hyperbolic sine of x  | ||
| + |             Cosh,          z = cosh(x)     -- Return the hyperbolic cosine of x  | ||
| + |             Tanh,          z = tanh(x)     -- Return the hyperbolic tangent of x  | ||
| + |             Asinh,         z = asinh(x)    -- Return the inverse hyperbolic sine of x  | ||
| + |             Acosh,         z = acosh(x)    -- Return the inverse hyperbolic cosine of x  | ||
| + |             Atanh,         z = atanh(x)    -- Return the inverse hyperbolic tangent of x  | ||
| + |             Factorial,     z = factorial(x)-- Return the factorial of x  | ||
| + |             Floor,         z = floor(x)    -- Return the floor (next lowest integer value) of x.  | ||
| + |             Ceil,          z = ceil(x)     -- Return the ceil (next highest integer value) of x.  | ||
| + |             Gcd,           z = gcd(x,y)    -- Return the GCD (greatest common divisor) of x, y.  | ||
| + |             Lcm,           z = lcm(x,y)    -- Return the LCM (least common multiple) of x, y.  | ||
| + | Beware! The following code will not work the same for Comet32 as it did for Comet16:  | ||
| + |          For I = 0 to 99                       | ||
| + |              A$ = "T" + sub(str(i+100),15,2)  | ||
| + |          Next i   | ||
| - | + | Because the result of the addition is in the accumulator which has changed.  | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | The following code will ALWAYS work for both Comet16 and Comet32:  | |
| - | + |         For I = 0 to 99  | |
| - | + |               A$ = `T' + sub(strip(str(i+100)),2,2)  | |
| - | + |         Next I  | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
Latest revision as of 22:49, 5 December 2017
Comet32 Numeric Processing
- Comet32 provides much enhanced numeric handling over Comet16.
 - Numeric variables can be as long as 32 decimal places. This is twice the length of Comet16.
 - Expression results are calculated to length 64.32 so that partial results of expressions are preserved.
 - The following Comet16 Functionality is supported::
 
           Add,           z = x + y
           Subtract,      z = x - y
           Multiply,      z = x * y
           Divide,        z = x / y
           Negate,        z = - x
           Abs,           z = abs(x)      -- Return the absolute value of x
           Int,           z = int(x)      -- Return the integer portion of x
           Fpt,           z = fpt(x)      -- Return the fractional portion of x
           Sgn,           z = sgn(x)      -- Return the sign of x (-1,0,+1)
           Num,           z = num(a$,err) -- Return the string a$ converted to a number.
           Asc,           z = asc(a$)     -- Return the ascii equivalent of the first character in a$.
           Len,           z = len(a$)     -- Return the length of string a$.
           BitwiseAnd,    z = x and y
           BitwiseOr,     z = x or y
           BitwiseXor,    z = x xor y
           BitwiseNot,    z = not(x)
           Mod,           z = x mod y     -- Divides int(x) by int(y) and return the remainder
           Sqrt,          z = sqrt(x)     -- Return the Square Root of x
           Rnd,           z = rnd()       -- Return a "random number" between 0 and 1
Many additional math functions are supported in Comet32:
           Cbrt,          z = cbrt(x)     -- Return the Cube Root of x
           Log,           z = log(x)      -- Return the base-e logarithm of x, so x==exp(z)
           Log10,         z = log10(x)    -- Return the base-10 logarithm of x, so x==pow(10,z)
           Exp,           z = exp(x)      -- Return e raised to the power x, so x==log(z)
           Pow,           z = pow(x,y)    -- Return x raised to the power y
           Sin,           z = sin(x)      -- Return the sine of x, with x in radians
           Cos,           z = cos(x)      -- Return the cosine of x, with x in radians
           Tan,           z = tan(x)      -- Return the tangent of x, with x in radians
           Asin,          z = asin(x)     -- Return the inverse sine of x, in radians
           Acos,          z = acos(x)     -- Return the inverse cosine of x, in radians
           Atan,          z = atan(x)     -- Return the inverse tangent of x, in radians
           Atan2,         z = atan2(y,x)  -- Return the 4 quadrant inverse tangent of y/x
           Sinh,          z = sinh(x)     -- Return the hyperbolic sine of x
           Cosh,          z = cosh(x)     -- Return the hyperbolic cosine of x
           Tanh,          z = tanh(x)     -- Return the hyperbolic tangent of x
           Asinh,         z = asinh(x)    -- Return the inverse hyperbolic sine of x
           Acosh,         z = acosh(x)    -- Return the inverse hyperbolic cosine of x
           Atanh,         z = atanh(x)    -- Return the inverse hyperbolic tangent of x
           Factorial,     z = factorial(x)-- Return the factorial of x
           Floor,         z = floor(x)    -- Return the floor (next lowest integer value) of x.
           Ceil,          z = ceil(x)     -- Return the ceil (next highest integer value) of x.
           Gcd,           z = gcd(x,y)    -- Return the GCD (greatest common divisor) of x, y.
           Lcm,           z = lcm(x,y)    -- Return the LCM (least common multiple) of x, y.
Beware! The following code will not work the same for Comet32 as it did for Comet16:
        For I = 0 to 99                     
            A$ = "T" + sub(str(i+100),15,2)
        Next i 
Because the result of the addition is in the accumulator which has changed.
The following code will ALWAYS work for both Comet16 and Comet32:
       For I = 0 to 99
             A$ = `T' + sub(strip(str(i+100)),2,2)
       Next I