Forum
SIN and COS functions have bug ? - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: SIN and COS functions have bug ? (/showthread.php?tid=2238)



SIN and COS functions have bug ? - papa_robot - 08-16-2022

Hello to the zx basic community. I'm integrating the compiler into my own spectrum bot.

I created a sample sinewave graph
Code:
FOR x = 10 TO 245 STEP 2
  PLOT x,100+SIN(2*x*PI/180)*50
NEXT x

However I see the values jump around 90 deg, see video here

https://twitter.com/ZxSpectrumBot1/status/1559654237507764224?s=20&t=7N7tbv0Kh7RktwCv438ECA

I cannot find any reference in the doc , it is supposed to be sinclair compatible, but in sinclair basic it works ok

https://twitter.com/ZxSpectrumBot1/status/1470172256714194950?s=20&t=7N7tbv0Kh7RktwCv438ECA

thanks a lot


RE: SIN and COS functions have bug ? - papa_robot - 08-17-2022

nevermind, declared x as float
dim x


RE: SIN and COS functions have bug ? - boriel - 08-17-2022

(08-17-2022, 12:44 AM)papa_robot Wrote: nevermind, declared x as float
dim x

Glad to see you catch it! Cool