Re: Fun with Floating-Point Numbers

John Mark Mobley via Coco <coco-uNHYcr1XS/wmlAP/[email protected]>
Newsgroups gmane.comp.hardware.tandy.coco
Message-ID <[email protected]>
Juan,

Very good!

-John Mark Mobley

-----Original Message-----
From: Coco <[email protected]> On Behalf Of Juan Castro via Coco
Sent: Monday, May 5, 2025 10:01 AM
To: CoCoList for Color Computer Enthusiasts <[email protected]>
Cc: Juan Castro <[email protected]>
Subject: Re: [Coco] Fun with Floating-Point Numbers

If it's large enough, it stays the same. How large, you ask? Try this:

10 A=100000
20 D=1.002937
30 B=A+1
40 C=B-A
50 IF C<>1 THEN END
60 PRINT A
70 A=INT(D*A)
80 GOTO 30

If you're in a CoCo 3, you can add "5 WIDTH 40:CLS" and "55 LOCATE 0,0" for neatness.

Juan Castro
Enviado do meu Olivetti Programma 101
http://retropolis.com.br


Em seg., 5 de mai. de 2025 às 11:51, John Mark Mobley via Coco < [email protected]> escreveu:

> All,
>
> What happens when you add one to a large floating-point number.
>
> 10 X=8.58993459E9
> 20 X=X-100
> 30 PRINT X
> 40 X=X+1
> 50 FOR T=1 TO 600:NEXT T
> 60 GOTO 30
>
> There's likely some rounding going on. And it stops counting at the 
> value shown in line 10.
>
> John Mark Mobley
>
>
> --
> Coco mailing list
> [email protected]
> https://pairlist5.pair.net/mailman/listinfo/coco
>

--
Coco mailing list
[email protected]
https://pairlist5.pair.net/mailman/listinfo/coco


-- 
Coco mailing list
[email protected]
https://pairlist5.pair.net/mailman/listinfo/coco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.