[comp.sys.tandy] Another TRS-80 Model 1 Level2 > CoCo problem 4U2 Fix!

ray3rd@ssc-vax.UUCP (Ray E Saddler III) (02/24/88)

Hello again, it's me, the guy trying to convert old BASIC to CoCo
basic.  

Klaas Hemstra (..!mh.nl!hst) was the 1st to give me the correct
answer to my previous question (the one regarding '[' being a '^'
for raising the power of...).

Anyhow, I've run across some lines that look like this;

150 B#=C*5
155 IF B# < 0 THEN GOTO 800
155 D#=B#/2

Alright, just what the heck do the pound signs do?  And what is the
equivalent in CoCo basic?

Anxiously awaiting a reply.....;^}


-- 
Ray E. Saddler III       |   Path: ..!ssc-vax!ray3rd    |    __  __ __       __
Boeing Aerospace Company |  From: ray3rd@ssc-vax.UUCP   |   / / / //   //| //
P.O. Box 3999 m.s. 3R-05 |------------------------------|  /-< / //-  // |// _
Seattle, Wa.  98124  USA |  VoiceNet: (206) 657-2824    | /__//_//__ //  //__/

ehr@ecsvax.UUCP (Ernest H. Robl) (02/25/88)

In article <1699@ssc-vax.UUCP>, ray3rd@ssc-vax.UUCP (Ray E Saddler III) writes:
> Hello again, it's me, the guy trying to convert old BASIC to CoCo
> basic.  
> .... [lines deleted]
> Anyhow, I've run across some lines that look like this;
> 150 B#=C*5
> 155 IF B# < 0 THEN GOTO 800
> 155 D#=B#/2
> Alright, just what the heck do the pound signs do?  And what is the
> equivalent in CoCo basic?
> Anxiously awaiting a reply.....;^}
> Ray E. Saddler III       |   Path: ..!ssc-vax!ray3rd    |    __  __ __       __
> Boeing Aerospace Company |  From: ray3rd@ssc-vax.UUCP   |   / / / //   //| //
> P.O. Box 3999 m.s. 3R-05 |------------------------------|  /-< / //-  // |// _
> Seattle, Wa.  98124  USA |  VoiceNet: (206) 657-2824    | /__//_//__ //  //__/


According to my Model III Basic manual, the # sign
indicates that you are dealing with double precision
variable.  I assume the same is true for a Model I.

The manual says "Double-precision numbers can include
up to 17 significant digits.... A double precision
value requires 8 bytes of memory for storage.
Arithmetic operations involving at least one double-
precision number are slower than the same opeations
when all operands are single-precision or integer."

Hope this helps.  -- Ernest
-- 
My opinions are my own and probably not IBM-compatible.--ehr
Ernest H. Robl  (ehr@ecsvax)  (919) 684-6269 w; (919) 286-3845 h
Systems Specialist (Tandem System Manager), Library Systems,
027 Perkins Library, Duke University, Durham, NC  27706  U.S.A.

leonard@bucket.UUCP (Leonard Erickson) (03/01/88)

In article <1699@ssc-vax.UUCP> ray3rd@ssc-vax.UUCP (Ray E Saddler III) writes:
<Hello again, it's me, the guy trying to convert old BASIC to CoCo
<basic.  
<
<Klaas Hemstra (..!mh.nl!hst) was the 1st to give me the correct
<answer to my previous question (the one regarding '[' being a '^'
<for raising the power of...).
<
<Anyhow, I've run across some lines that look like this;
<
<150 B#=C*5
<155 IF B# < 0 THEN GOTO 800
<155 D#=B#/2
<
<Alright, just what the heck do the pound signs do?  And what is the
<equivalent in CoCo basic?

You've probably got *big* trouble here...

In most of the various Microsoft BASICs out there, there are 3 kinds of
numbers:

1.  Integer,               stored in 2 bytes, range -32768 to +32767 
2.  Single precision real, stored in 4 bytes, range -1.701411e[+-]38 to 
						    +1.701411e[+-]38
3.  Double precision real, stored in 8 bytes, range -1.701411834544556e[+-]38
						    +1.701411834544556e[+-]38

To distinguish among these different types of numbers a suffix is used
(much like using the $ suffix to indicate that a variable is a string).
The suffixes are :
%	integer
!	single precision (default on models 1,3 & 4)
#	double precision (default on Model 100)

So B# means *double precision real B* and is not the same as B! or B%.
The trouble comes into play now. For some unknown reason the CoCo only
has *one* numeric format. And it is different from all the above!
"CoCo real"    stored in 5 bytes, range ????? (not stated anywhere I
                can find in the manuals)

So If you are (for instance) trying to convert the "double precision math
subroutines" package, give up. Your built in functions give you as much
accuracy as you are going to get from the CoCo. Double precision is so
much slower than single, that it is only used when the program *needs*
the extra precision (15 digits as opposed to the 7 that single gives).

Lots of luck!


-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."