From 4465273da22260b60b5007d8a9ed7d5168c28d4b Mon Sep 17 00:00:00 2001 From: Alex Knauth Date: Sun, 1 Oct 2017 17:36:23 -0400 Subject: [PATCH] Should TR optimizer docs recommend real->double-flonum (#498) instead of exact->inexact? Since its usage in the guide is to create a value of type Float on which TR can apply optimizations, real->double-flonum seems like the the better choice. The type of exact->inexact can sometimes produce single flonums or complex numbers, but real->double-flonum always returns a Float. For converting exact complex numbers into inexact complex numbers I don't see another option; I'm not sure what to do there. --- .../typed-racket/scribblings/guide/optimization.scrbl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typed-racket-doc/typed-racket/scribblings/guide/optimization.scrbl b/typed-racket-doc/typed-racket/scribblings/guide/optimization.scrbl index ddb9cf60..7abe7653 100644 --- a/typed-racket-doc/typed-racket/scribblings/guide/optimization.scrbl +++ b/typed-racket-doc/typed-racket/scribblings/guide/optimization.scrbl @@ -73,8 +73,8 @@ operations, the result is not necessarily a @racket[Float]. For instance, the result of @racket[(* 2.0 0)] is @racket[0] which is not a @racket[Float]. This can result in missed optimizations. To prevent this, when mixing floating-point numbers and exact reals, coerce exact -reals to floating-point numbers using @racket[exact->inexact]. This is -not necessary when using @racket[+] or @racket[-]. When mixing +reals to floating-point numbers using @racket[real->double-flonum]. +This is not necessary when using @racket[+] or @racket[-]. When mixing floating-point numbers of different precisions, results use the highest precision possible.