typed-racket
typed-racket copied to clipboard
acos unsound in TR
Per the discussion in
https://racket.discourse.group/t/acos-behaves-differently-on-s-1-0-in-tr/3453
... it appears there is a soundness problem around the use of flacos to implement acos in TR. Specifically, this program, constructed by @usaoc , demonstrates that a term with type Flonum can produce a complex number:
#lang typed/racket/base #:no-optimize
(ann (acos 1.5) Flonum) ; result is 0.0+0.9624236501192069i, not a flonum
Many thanks to @usaoc and Shawn Wagner for identifying the underlying issue.
This issue has been mentioned on Racket Discourse. There might be relevant details there:
https://racket.discourse.group/t/acos-behaves-differently-on-s-1-0-in-tr/3453/5
Unfortunately, fixing this exposes problems in a number of other libraries. In particular, some math library operations will have different and more limited types (they were of course wrong before).