-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentationmathsMathematical functionsMathematical functions
Description
At least until div
is fixed for floats (#49561).
At the moment the docstrings for div
refer only to integers, but there's no type restriction on the inputs which leads to a discrepancy if called with floats:
julia> div(1.0, 0.1, RoundToZero)
9.0
julia> round(1.0 / 0.1, RoundToZero)
10.0
This is of course because decimals such as 0.1 don't have an exact floating-point representation so the result can differ when rounded down; the docstring for fld
includes this warning, but div
does not, so even simple operations such as 1.0 ÷ 0.1
can lead to unintuitive results if this is not specified.
oscardssmith
Metadata
Metadata
Assignees
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentationmathsMathematical functionsMathematical functions