You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, even though they kind of boil down to the same thing in implementation for most types, they do not specifically for floating point numbers. Moreover, if one defines a max function with compare, for example like this:
letmax2 x y =if compare x y <0then y else x
Then max2 behaves differently than max with respect to NaN, e.g.:
> max2 1. nan;;
val it: float = 1.0
> max2 nan 1.;;
val it: float = 1.0
whereas
> max nan 1.;;
val it: float = nan
> max 1. nan;;
val it: float = nan
If this discrepancy in behavior is expected, then perhaps it should be documented?
The text was updated successfully, but these errors were encountered:
Not sure if this is an error in documentation or purposeful omission, or perhaps a bug in fsharp.
Here
max
is described asAnd here
compare
is described asHowever, even though they kind of boil down to the same thing in implementation for most types, they do not specifically for floating point numbers. Moreover, if one defines a max function with
compare
, for example like this:Then
max2
behaves differently thanmax
with respect to NaN, e.g.:whereas
If this discrepancy in behavior is expected, then perhaps it should be documented?
The text was updated successfully, but these errors were encountered: