Vtech PreComputer Power Pad Plus User Manual - Page 56

Arithmetic Functions

Page 56 highlights

ARITHMETIC FUNCTIONS ABS (X) This gives the absolute (positive) value of the argument. So ABS (-7)=7. Example: PRINT ABS (7-2*4) 1 press ENTER SGN (X) This function will give the value of +1 if X is positive, 0 if X is zero, and -1 if X is negative. So SGN(4.3)=1; SGN(0)=0; SGN(-276)=-1 Example: A=6 PRINT SGN (A); SGN (A-A) 1 0 press ENTER press ENTER INT (X) This converts numbers which are not whole into the largest whole number below the argument. So INT (5.9)=5; also INT (-5.9)=-6. Note that with negative arguments, the absolute value of the result returned by INT will be greater than that of the number. Example: PRINT INT (-6.7) -7 press ENTER RND (X) This will produce a random number between 1 and X if X is a positive number. 52

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

52
ARITHMETIC FUNCTIONS
ABS (X)
This gives the absolute (positive) value of the argument.
So ABS (-7)=7.
Example:
PRINT ABS (7-2*4)
press
ENTER
1
SGN (X)
This function will give the value of +1 if X is positive, 0 if X is zero, and -1 if X is negative.
So SGN(4.3)=1; SGN(0)=0; SGN(-276)=-1
Example:
A=6
press
ENTER
PRINT SGN (A); SGN (A-A)
press
ENTER
1
0
INT (X)
This converts numbers which are not whole into the largest whole number below the
argument.
So
INT
(5.9)=5; also
INT
(-5.9)=-6.
Note that with negative arguments, the
absolute value of the result returned by
INT
will be greater than that of the number.
Example:
PRINT INT (-6.7)
press
ENTER
-7
RND (X)
This will produce a random number between 1 and X if X is a positive number.