z80float icon indicating copy to clipboard operation
z80float copied to clipboard

cos(0) should be 1

Open john-blackburn opened this issue 2 years ago • 1 comments

f24/f24cos.z80 says cos(0)==0 in the comments. But cos(0)=1

john-blackburn avatar Sep 23 '23 14:09 john-blackburn

In my code I have changed the first few lines of this routine to

f24cos:
;cos(AHL) ==> AHL

;cos(0) == 1    ; fixed by JFB
  add a,a
  jr nz,f24cos_skip
  ld a,$3F ; 1.0
  ld hl,0
  ret

;cos(inf)==cos(NaN)==NaN
f24cos_skip:
  rrca
  cp $7F

:

john-blackburn avatar Sep 29 '23 20:09 john-blackburn