Page 1 of 1

Decimal Value

Posted: Mon Jan 18, 2021 6:49 pm
by tokabln
Folks,

I'm probably stupid but I'm actually failing to enter the following command using Spectrum Basic:

LET TEST=123456,789

When I hit the ENTER key I get

LET TEST=123456,?789L

So I'm not able to assign 123456,789 to TEST.

Any help is appreciated.

Re: Decimal Value

Posted: Mon Jan 18, 2021 7:13 pm
by zsolt
Use a dot instead of comma. ;)
HTH,
Zsolt

Re: Decimal Value

Posted: Mon Jan 18, 2021 7:37 pm
by tokabln
Thanks, but this doesn't work, too. :(

So this was just an example: LET TEST=123456,789

The real value I try to enter is: LET TEST=299792.999 so I believe it doesn't met the number range that can be handled.

Re: Decimal Value

Posted: Mon Jan 18, 2021 8:16 pm
by Tiger
I tried it with an Harlequin 128. With 128k-Basic and also 48K Basic it seems to work, but with "PRINT test" I receive "299793". Is this "round-function" the problem?
With "PRINT test - 1.099" I receive "299791.9" so it seems the variable "test" is correctly stored.

Re: Decimal Value

Posted: Mon Jan 18, 2021 8:39 pm
by tokabln
Well... I'm not struggling with a rounding... which works for me as well.

I forgot to mention that I try to enter a Basic command line... for example

40 LET v=299272.999

and here I fail... because here I get : 40 LET v=299272.?999L

Supplement:
Okay... it seems to be, that my installed APU card... is the problem. When it's uninstalled... everthing works fine.
So I need to dig into this problem first, because I'd like to use the arithmetic processor for a calculation where the above command is part of a program.

So thanks for the given feedback so far.

Re: Decimal Value

Posted: Mon Jan 18, 2021 9:22 pm
by 1024MAK
tokabln wrote: Mon Jan 18, 2021 6:49 pm Folks,

I'm probably stupid but I'm actually failing to enter the following command using Spectrum Basic:

LET TEST=123456,789

When I hit the ENTER key I get

LET TEST=123456,?789L

So I'm not able to assign 123456,789 to TEST.

Any help is appreciated.
ZX81 and ZX Spectrum basic uses a dot/decimal point/full stop as the separator for the fractional part.
Hence LET TEST=123456,789 will result in a syntax error, indicated by the system refusing to enter the command and instead printing a question mark next to the bit of the entry it’s not happy with. This is the syntax checker at work.

Here is a screenshot of a similar command in a short program where a decimal point is used:
ADA8850C-0ABD-4B02-B09D-00F375D46A7A.jpeg
This happens to be a ZX81 emulator, but it should work on a ZX Spectrum as well.

Keep in mind that different languages/countries use different symbols for the separator.
In English / the U.K., we use the comma “,” to separate the thousands. Hence you will see 123456.789 written as 123,456.789 with 789 being the decimal fraction.
For more on this see the Wikipedia article
90ABC1C9-B18E-4A15-88BC-390309CDD92C.jpeg
Mark

Re: Decimal Value

Posted: Tue Jan 19, 2021 10:12 am
by tokabln
@1024MAK:

Thanks for your feedback... I do found the problem, which is related to my external Arithmetic Coprocessor Card. Not sure why, without this card, everything works well. So I need to find the (HW/SW?) problem of my card, first.

Again, many thanks

Re: Decimal Value

Posted: Fri Feb 26, 2021 1:16 am
by matalog
Where do you install such a card on a Spectrum?

Re: Decimal Value

Posted: Fri Feb 26, 2021 2:51 am
by bola_dor
tokabln wrote: Tue Jan 19, 2021 10:12 am @1024MAK:

Thanks for your feedback... I do found the problem, which is related to my external Arithmetic Coprocessor Card. Not sure why, without this card, everything works well. So I need to find the (HW/SW?) problem of my card, first.

Again, many thanks
What card is it??