## COMPLEX

### COMPLEX

Hello.

In order to talk, somehow seriously, about mathematics in a computer

language, we need to have access to data of type COMPLEX, at least.

Sincerely,

Petros Zimourtopoulos

In order to talk, somehow seriously, about mathematics in a computer

language, we need to have access to data of type COMPLEX, at least.

Sincerely,

Petros Zimourtopoulos

### Re: COMPLEX

I always use a structure for this:

Code: Select all

```
DIM COMPLEX{r,i}
```

Code: Select all

```
DIM a{} = COMPLEX{}, b{} = COMPLEX{}
```

Code: Select all

```
a{} = b{}
```

Code: Select all

```
PROCcomplexadd(o{}, a{}, b{})
```

### Re: COMPLEX

But you posted to a BBC BASIC forum, and the answer I gave is the most "serious" one relevant to BBC BASIC that I know of. You will be pleased to learn that my membership of this forum expires in about two weeks time, after which you will not be troubled by replies from me that you don't like.

### Re: COMPLEX

.guest wrote: ↑Sat 05 Jan 2019, 22:20But you posted to a BBC BASIC forum, and the answer I gave is the most "serious" one relevant to BBC BASIC that I know of. You will be pleased to learn that my membership of this forum expires in about two weeks time, after which you will not be troubled by replies from me that you don't like.

- hello - i am terribly sorry for the inconvenience - you are right - this

is the answer, of course - please, accept my apologies - sincerely - pez -

- ps - i just tried to contribute, imho: constructively, by proposing

a possible way out from this lingering dead end of mathematics in this

beloved, from a long time now, language - farewell -

.

### Re: COMPLEX

It's not clear to me what you were "proposing". BBC BASIC is over 37 years old, and the core language hasn't changed significantly for decades; even the extensions to the language that I have added (none of which were as drastic or risky as the introduction of a COMPLEX data type would be) were completed at least four years ago.

Indeed I have always believed that one of the strengths of BBC BASIC is its stability, and now there are three versions with different source trees ('BBC BASIC for Windows', 32-bit 'BBC BASIC for SDL 2.0' and 64-bit 'BBC BASIC for SDL 2.0') any future changes would have to be made to all three, which implies being implemented in both assembly language and C code! And only one of them is Open Source.

I have also always argued that the only way an extension to BBC BASIC can be justified is if the existing language features cannot adequately achieve the required functionality, and that's not the case with complex numbers. As I showed, and the Rosetta Code task further demonstrated, BBC BASIC

**capable of supporting complex arithmetic in a reasonably elegant fashion.**

*is*If one looks at the large number of languages for which a solution to the Rosetta Code Arithmetic/Complex task have been submitted, the great majority do not have a built-in COMPLEX data type and most of those use a structure in exactly the same way that I proposed. Even the Java solution does effectively the same thing.

So I don't think BBC BASIC has anything to be embarrassed about in respect of its support for complex numbers.