Sharp OZ-707 Operation Manual - Page 25

Defdbl

Page 25 highlights

Double-precision variables have 20 significant digits and a 2 digit exponent from -99 to 99. Note: Single-character variables to which the sharp mark is appended (e.g. A#) are not fixed numeric variables, but are treated as double-precision simple numeric variables. The following types of variables are stored in separate memory areas: A and AB and X(10) and A# AB# X#(10) Variables can be specified as single-precision (10-significant-digit) variables by appending an exclamation mark ( ! ), or as double-precision (20-significant-digit) variables by the sharp mark (#). However, the Card makes it possible to treat any numeric variable as a single- or double-precision variable by the DEFSNG (define single) and DEFDBl (define double) statements. This is especially useful if your program contains numerous double-precision variables. Storing Values In Double-Precision Variables 1. Using Declarative Signs (I and #) AB! (or AB) = 1234567891234567891234 ~ 1.234567891 x 1021 The value is stored using 10 significant digits in the single-precision variable ABI (or AB). AB# = 1234567891234567891234 ~ 1.2345678912345678912 x 1021 The value is stored using 20 significant digits in the double-precision variable AB#. 2. Using Declarative Signs and Declarative Statements (DEFSNG and DEFDBl) These are two BASIC commands used as variable definition statements. See Chapter 3 for a description of programming. 38 Mixing Double- and Single-Precision Values If a calculation includes double-precision variables, the Card will automatically select double-precision mode where necessary. Double-precision mode is automatically selected in the following cases: Calculations are executed on values containing 11 or more significant digits: Ex. 1234567891234 x 5 The letter D is used in formulas to specify an exponent: Ex. TAN 7.43005 Values are identified using the sharp mark (#): Ex. 4#{l Double-precision variables are used: Ex. AB# + BC The DEFDBl statement is used: Ex. In RUN mode, enter DEFDBL. DBl is highlighted in the MODE CHECK display. DEFDBl IENTER I 51: 191ENTERI DEFDBL 5/ 9 5.55555555555555 55556D-01 If the calculation formula contains a mixture of single- and double-precision values, each individual calculation within the formula is executed according to the degree of precision valid at that time. + 4#{l Single-precision Double-precision Double-precision calculation If double-precision values are converted to single-precision variables, the double-precision value is rounded to 10 significant digits. 39

  • 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
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128

Double-precision variables have 20 significant digits and a 2 digit
exponent from
-99
to 99.
Note:
Single-character variables to which the sharp mark is appended (e.g.
A#) are not fixed numeric variables, but are treated as double-precision
simple numeric variables.
The following types of variables are stored in separate memory areas:
A
and
AB
and
X(10)
and
A#
AB#
X#(10)
Variables can
be
specified as single-precision (10-significant-digit)
variables by appending an exclamation mark ( !
),
or as
double-precision (20-significant-digit) variables by the sharp mark
(#)
.
However, the Card makes it possible to treat any numeric variable as a
single-
or
double-precision variable by the DEFSNG (define single) and
DEFDBl
(define double) statements. This is especially useful if your
program contains numerous double-precision variables.
Storing Values In Double-Precision Variables
1. Using Declarative Signs
(I
and #)
AB! (or AB)
=
1234567891234567891234
~
1.234567891 x 10
21
The value is stored using 10 significant digits
in
the single-precision
variable ABI (or AB).
AB#
=
1234567891234567891234
~
1.2345678912345678912
x
10
21
The value is stored using 20 significant digits in the double-precision
variable AB#.
2. Using Declarative Signs and Declarative Statements (DEFSNG and
DEFDBl)
These are two BASIC commands used as variable definition
statements. See Chapter 3 for a description of programming.
38
Mixing Double- and Single-Precision Values
If a calculation includes double-precision variables, the Card will
automatically select double-precision mode where necessary.
Double-precision mode is automatically selected in the following cases:
Calculations are executed on values containing
11
or
more significant
digits:
Ex. 1234567891234
x
5
The letter D is used
in
formulas to specify an exponent:
Ex. TAN 7.43005
Values are identified using the sharp mark (#):
Ex.
4#{l
Double-precision variables are used:
Ex. AB# +
BC
The
DEFDBl
statement is used:
Ex. In RUN mode, enter DEFDBL.
DBl
is highlighted
in
the
MODE CHECK display.
DEFDBl
I
ENTER
I
51:
191ENTERI
DEFDBL
5/ 9
5.55555555555555
55556D-01
If the calculation formula contains a mixture of single- and
double-precision values, each individual calculation within the formula
is
executed according to the degree of precision valid at that time.
+
4#{l
Single-precision
Double-precision
Double-precision calculation
If double-precision values are converted to single-precision variables,
the double-precision value is rounded to 10 significant digits.
39