fsharp / fsharp/fsharp-core-docs
Inaccurate/misleading description of max in operators module (wrt. NaN comparison)
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 37
- Fork
- 20
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
Not sure if this is an error in documentation or purposeful omission, or perhaps a bug in fsharp.
[Here](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-operators.html#max) `max` is described as
> Maximum based on generic comparison
And [here](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-operators.html#compare) `compare` is described as
> Generic comparison.
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:
```fsharp
let max2 x y = if compare x y < 0 then 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?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Xem xét các mục tài liệu được tạo cho max và compare được liên kết trong issue, sau đó tái hiện các ví dụ NaN được nêu để xác nhận hành vi. Xác định xem sự khác biệt có nằm trong dự kiến hay không; được coi là hoàn tất khi tài liệu giải thích chính xác hành vi NaN của max hoặc issue được chứng minh là một bug cần một bản sửa riêng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100