Go to advanced search

by RichardRussell
Wed Jul 17, 2019 4:06 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

While it is true that a floating point value can hold a integral value greater than 2^32-1, that is still being stored as a floating point value. You seem to like to concentrate on implementation detail, when that shouldn't matter to the programmer. Regardless of how it's stored, it's an integer! B...
by RichardRussell
Wed Jul 17, 2019 8:50 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

if it supports up to 53-bit integers (as ARM BASIC 6 and Brandy do) Unless I'm doing something wrong, they don't. You are trying to load the number into an integer-type variable a% . Obviously that is going to fail, because integer variables can hold only 32-bit integers. But ordinary (non % suffix...
by RichardRussell
Wed Jul 17, 2019 8:30 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

It would be interesting if anyone knows why the designers of BBC Basic chose to break with tradition and defined LOG as the base-10 logarithm. I've received a couple of answers at StarDot: " The original MS 1978 BASIC did indeed only support log base-e with the LOG keyword. This version was license...
by RichardRussell
Wed Jul 17, 2019 8:18 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

In BBC BASIC 6 (BBC BASIC V with 64-bit floats) it is following the definition of the language, which says that INT floors to the integer and that the integer must fit in the languages integer variable type. You really can't excuse an undesirable feature on the grounds that it follows "the definiti...
by RichardRussell
Tue Jul 16, 2019 9:57 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

According to the documentation that comes with bwBASIC the following BASIC dialects used LOG for natural logarithm I'm not sure of the relevance of that. As I said, the BBC requested of Acorn that BBC BASIC be largely compatible with the 8-bit Microsoft BASICs of the day, so what other BASICs may o...
by RichardRussell
Tue Jul 16, 2019 8:59 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

the strange notation in BBC Basic to me is using LOG to stand for base-10 logarithms. This is unique among the Basic dialects I know. I can't enlighten you on that one; although I was there at the time (1981) I don't recall any discussions on that topic. All I know is that the BBC required of Acorn...
by RichardRussell
Tue Jul 16, 2019 8:43 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

Maybe I'm out of line but I would naturally expect an int function to do this simplest thing and just throw away the bits after the decimal point. Thus producing the closest integer towards zero. The most common use to which I put the INT function is in rounding a number to the nearest integer: nea...
by RichardRussell
Tue Jul 16, 2019 8:28 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

That norm is only for BASIC implementations that store integers primarily in floating point (like most older MS-BASIC implimentations). I have literally no idea what that means. The way a standard function like INT() behaves obviously should not, and must not, depend on implementation details. In B...
by RichardRussell
Tue Jul 16, 2019 8:08 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

I do find it strange that it truncates towards minus infinity rather than zero as is the norm. Is there something mathematical I am missing, because Python division does the same? The norm? In BASIC it is absolutely standard for the INT() function to truncate towards minus-infinity ('floor'): try i...
by RichardRussell
Tue Jul 16, 2019 5:57 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

This has, unsurprisingly, uncovered a bug in Matrix Brandy. Will this affect other versions of Brandy (Napoleon Brandy etc.), or is it in an area where you modified the code for Matrix? INT was accepting values that were out of range (which is not allowed on the BBC Micro nor RISC OS BBC BASIC impl...
by RichardRussell
Tue Jul 16, 2019 8:55 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

The classic BASIC program should automatically detect the floating-point precision and proceed accordingly. In coding that test have you assumed that floats will be either 32-bits or 64-bits? If so that might explain it failing to run on early BBC BASICs, because they all use 40-bit floats (32-bit ...
by RichardRussell
Tue Jul 16, 2019 8:37 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

Arguably DavidS is correct in his assertion that the tokenized form of BASIC is the source code in that case. Ignoring the fact that it's not what you see on the screen which is just regular text. No, I don't think so. Tokens are just shorthand for keywords, they shorten the program and speed up ex...
by RichardRussell
Mon Jul 15, 2019 7:33 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

No bug, all documentation of the INT function (parens optional) explicitly states for int real that real must be in the range of possible integers . That's still ambiguous. By "possible integers" it seems to mean "values which can be stored in an integer variable" but why should it? You can perfect...
by RichardRussell
Mon Jul 15, 2019 6:20 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

Also note that the use of the INT function requires that the result be stored as an integer at least for a moment in an ARM register. If that means you can't use INT() to truncate a value greater than 2^31 to an integer (despite BASIC 6's 64-bit float variables being able to hold much bigger intege...
by RichardRussell
Mon Jul 15, 2019 5:21 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

DavidS wrote:
Mon Jul 15, 2019 5:07 pm
Actually I am using BASIC 6 (I just think of it as BASIC V, as it is the same langage).
Right. In that case I don't think the 'classic BASIC' Fibo program should fail, because 64-bit floats can hold integers up to about 53 bits. If it is failing I don't understand why. What's the error message?
by RichardRussell
Mon Jul 15, 2019 5:18 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

DavidS wrote:
Mon Jul 15, 2019 5:02 pm
And how is my upercased RISC OS formated text version on your BBC BASIC?
I've not tried it, because it's got colons at the beginning of every line. Where have they come from? Typically they will break BBC BASIC:

Code: Select all

10 : IF FALSE THEN
20 : ENDIF
This reports 'Missing ENDIF in line 10'.
by RichardRussell
Mon Jul 15, 2019 5:03 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

It does not yet work in ARM BASIC (BBC BASIC V on RISC OS), do to getting an integer greater than 32-bits in line 8550. Though I am sure that is not a problem with Richard Russels version. I believe it requires at least double (64-bit) precision floats, so if that's the only issue try running it in...
by RichardRussell
Mon Jul 15, 2019 4:58 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

Sounds reasonable. I could have a go at fixing it, but to be sure it get's done properly would you mind doing the honors. Pretty please. I think this is it: REM fibo_bbc.bas REM This is the classic.bas Fibonacci(4784969) calculator REM with slight modifications to run under Richard Russell's BBCBas...
by RichardRussell
Mon Jul 15, 2019 4:49 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

I think there was a version of the same code for 32-bit... Ah, what you're missing is that my 32-bit interpreters still support 64-bit integer variables: you don't need a 64-bit CPU for that! It may seem superficially strange, but it's no different from C which supports the long long data type even...
by RichardRussell
Mon Jul 15, 2019 3:58 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

The line numbers are not the first thing on the line That has never been a requirement in BBC BASIC. Every implementation of the language I know, including ARM BASIC V, is happy to accept spaces before the line number. the keywords are lower case, I agree that Heater should not list a program with ...
by RichardRussell
Mon Jul 15, 2019 8:28 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

Though where is the library with PROCbigmul and PROCbigadd ? Or did you not get far enogh for those two to work? As I've said, I developed the library only far enough to allow the Fibo application to run (which it does, so obviously those procedures work!). Specifically there is no support for nege...
by RichardRussell
Mon Jul 15, 2019 8:18 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

I wonder if interpretive tokenized code is worth the effort these days? I'm not sure what point you're making here. There is obviously less "effort" involved in interpreting a program compared with compiling it (using those terms in their traditional senses) and tokenisation is simply a method of s...
by RichardRussell
Sun Jul 14, 2019 10:46 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

Ah, so that last code post is not a Fibo Challenge entry and I can forget it. Right? You are correct that I have never submitted an entry for the 'Fibo Challenge' (I don't know what the process is for doing so, or even who the challenge was organised by). My limited understanding of the rules is th...
by RichardRussell
Sun Jul 14, 2019 10:05 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

How did I miss that. I'll give it a spin and replace the Fibo Challenge entry in the repo. If that is OK with you. The issue is that it relies on my 'bigint' library which was thrown together for the challenge and never completed. I had hoped that somebody would take up the reins and develop what I...
by RichardRussell
Sun Jul 14, 2019 9:55 pm
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 553
Views: 37010

Re: Introduction to BBC BASIC

it's a lot faster than a PROC call which sets up local vars and suchlike before executing. In BBC BASIC a procedure without parameters doesn't have any 'local' variables (unless explicitly declared using LOCAL) so there is literally nothing more to 'set up' than there is with GOSUB (just pushing th...

Go to advanced search