Decimal Value

Post Reply
User avatar
tokabln
Posts: 19
Joined: Sun Jan 17, 2016 4:24 pm

Decimal Value

Post 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.
Kind regards Torsten (Berlin)
BMZ MFA, ZX80Core/More, AX81, ZX81, ZX81NU, Spectrum+, Harlequin, Amstrad NC100, Z88, C64, C128D, Amiga 500, Amiga 1200, Atari Portfolio, HP200LX, IBM PC 5155, TP755c, T41, PS/2 (Model 40SX), PS/2E, Accura 101, Apple //e
User avatar
zsolt
Posts: 214
Joined: Wed Apr 20, 2011 11:43 am
Location: Fót, Hungary

Re: Decimal Value

Post by zsolt »

Use a dot instead of comma. ;)
HTH,
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
User avatar
tokabln
Posts: 19
Joined: Sun Jan 17, 2016 4:24 pm

Re: Decimal Value

Post 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.
Kind regards Torsten (Berlin)
BMZ MFA, ZX80Core/More, AX81, ZX81, ZX81NU, Spectrum+, Harlequin, Amstrad NC100, Z88, C64, C128D, Amiga 500, Amiga 1200, Atari Portfolio, HP200LX, IBM PC 5155, TP755c, T41, PS/2 (Model 40SX), PS/2E, Accura 101, Apple //e
User avatar
Tiger
Posts: 25
Joined: Tue Sep 01, 2020 10:37 am

Re: Decimal Value

Post 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.
User avatar
tokabln
Posts: 19
Joined: Sun Jan 17, 2016 4:24 pm

Re: Decimal Value

Post 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.
Kind regards Torsten (Berlin)
BMZ MFA, ZX80Core/More, AX81, ZX81, ZX81NU, Spectrum+, Harlequin, Amstrad NC100, Z88, C64, C128D, Amiga 500, Amiga 1200, Atari Portfolio, HP200LX, IBM PC 5155, TP755c, T41, PS/2 (Model 40SX), PS/2E, Accura 101, Apple //e
User avatar
1024MAK
Posts: 3553
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Decimal Value

Post 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
User avatar
tokabln
Posts: 19
Joined: Sun Jan 17, 2016 4:24 pm

Re: Decimal Value

Post 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
Kind regards Torsten (Berlin)
BMZ MFA, ZX80Core/More, AX81, ZX81, ZX81NU, Spectrum+, Harlequin, Amstrad NC100, Z88, C64, C128D, Amiga 500, Amiga 1200, Atari Portfolio, HP200LX, IBM PC 5155, TP755c, T41, PS/2 (Model 40SX), PS/2E, Accura 101, Apple //e
matalog
Posts: 5
Joined: Thu Feb 18, 2021 5:13 pm

Re: Decimal Value

Post by matalog »

Where do you install such a card on a Spectrum?
bola_dor
Posts: 243
Joined: Wed Oct 02, 2019 5:32 am

Re: Decimal Value

Post 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??
Ernesto
ZX80, TK83, CZ1000, CZ1500, CZ2000, CZ1000Plus, CZ Spectrum, CZ Spectrum Plus, TS2068, Sinclair QL. TS 1016, TS1040. And more to come :D
Post Reply