RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Community Support →

@%="+F8.6"

Subscribe to @%="+F8.6" 9 posts, 6 voices

 
Jan 10, 2021 2:44pm
Avatar Bryan (8467) 215 posts

I have a BASIC program which used to compile when it had statements like @%=&1020608

Recently, I discoved @%=“+F8.6” and changed all of the many different instances to the string format, which all worked perectly under interpretation and were/are much easier to understand when reading the code.

But, now it won’t compile (an obvious Type Mismatch).

What is the recommended way to solve this dilema?

 
Jan 10, 2021 3:11pm
Avatar Rick Murray (539) 10553 posts

Note that ABC supports a version of BASIC as it was in the RISC OS 3.10 days. LOCAL quirks aside, it is woefully out of date compared to the BASIC interpreter itself.

 
Jan 10, 2021 11:03pm
Avatar Bryan (8467) 215 posts

I think I would describe this as a fudge rather than a quirk. I now know that despite the apparant attempt to assign a string to an integer variable, the end result is that @% finishes up with an integer value; as shown by.

 >@%="+F8.6"
 >PRINT ~@%
  1020608

It looks like I am going to have to edit it all back to how it was with RISC OS 3.10 2.0

Maybe, I should create some new constants

 >F8pt6=&1020608
 >@%=+F8pt6
 >PRINT ~@%
  1020608
 
Jan 11, 2021 10:17am
Avatar Colin Ferris (399) 1056 posts

How about
Eval
SYS 45,hex$ TO ,,int%

 
Jan 11, 2021 10:29am
Avatar Grahame Parish (436) 330 posts

I would have thought the EVAL was the problem here – it isn’t compilable, and Bryan’s original format is probably dealt with as an EVAL to be able to set an integer variable from a string.

 
Jan 11, 2021 10:35am
Avatar Colin Ferris (399) 1056 posts

The ‘SYS Eval’ version doesn’t do everything -but can be very handy with the ABC compiler.

 
Jan 11, 2021 12:11pm
Avatar Alan Adams (2486) 509 posts

I now know that despite the apparant attempt to assign a string to an integer variable, the end result is that @% finishes up with an integer value; as shown by.

Yes, this is a special case in BASIC.

 
Jan 11, 2021 1:34pm
Avatar Bryan (8467) 215 posts

It has been described here as a ‘quirk’ or a ‘special case’. My prefered option is still ‘fudge’.

I will be changing the code to use the canstants decribed above

 
Jan 11, 2021 3:44pm
Avatar Steve Drain (222) 1336 posts

What is the recommended way to solve this dilema?

Do not bother with ABC, perhaps. ;-)

My prefered option is still ‘fudge’.

Yes it is. The string form was introduced as ANSI printf comparable. It is really simple to make @$ a synonym for @% to make it “look right”, but however it is done it is stored as an integer.

Reply

To post replies, please first log in.

Forums → Community Support →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

Community-provided support for all users of RISC OS.

Voices

  • Bryan (8467)
  • Rick Murray (539)
  • Colin Ferris (399)
  • Grahame Parish (436)
  • Alan Adams (2486)
  • Steve Drain (222)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys