Petit Computer Wiki
Petit Computer Wiki
Advertisement

V1[]

POW is not a function in SmileBasic V1.

V2[]

POW(BASE,EXPONENT) is a function which takes two numerical parameters, and calculates BASE raised to the power of EXPONENT. If EXPONENT is a noninteger number, and BASE is negative, the system generates an Illegal function call (POW) error. If only one parameter is given, the system makes Syntax error (POW); if one or both of the parameters is a string, the system gives a Type Mismatch (POW) error; if three or more parameters are given, the system makes a Missing operand (POW) error.

POW(X,0) always gives 1. POW(X,1) always gives X, except when X is 524287.999755859375; then, the system generates an Overflow error, for absolutely no good reason.

Since POW has two parameters, it essentially has two inverses. Given the result of a POW calculation (call it P), and N, X can be calculated by using POW(P,1/N). Given P and X, N can be calculated by using LOG(N)/LOG(X).

V3[]

Indications are, POW in SmileBasic V3 is identical to that in V2, except presumably, the "524287.999755859375" bug is fixed.

Advertisement