On Sat, Aug 29, 2020 at 8:07 AM Jim Rees <xxxxxx@gmail.com> wrote:

3) make do the comparison only after converting the lower precision nan to the higher precision nan first.

#3 makes the most sense to me because given that nan payloads are expected to be propagated through operations,   R7RS requires the result of a computation to represent at least the highest precision among its arguments, so:

                          (+ special-nan.f  1.0d0) ==> special-nan.d

...where special-nan.d is whatever the platform would have done to convert special-nan.f from single to double-precision.

So, when someone wants to propagate a special nan (for example "NA" in the R system) through a computation and check for that , they can do:

                           (nan= result NA)

..and it will return true, even if the computation resulted in a promotion to higher precision.

I don't know if there's a specification on how NaN payloads are treated in the precision conversion.  I think there's none in IEEE754 but I haven't checked it thoroughly.
If so, (nan= special-nan.f special-nan.d) doesn't tell anything except a specific implementation-dependent behavior.  Won't harm, but it seems just as well to say passing different precisions of NaNs won't raise an error but the result is implementation-dependent.