typed-racket icon indicating copy to clipboard operation
typed-racket copied to clipboard

acos unsound in TR

Open jbclements opened this issue 11 months ago • 2 comments

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.

jbclements avatar Dec 31 '24 13:12 jbclements

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).

samth avatar Jan 16 '25 16:01 samth