Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note to unsafe_trunc docstring #54297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kimikage
Copy link
Contributor

cf. #54264

The behavior of unsafe_trunc for out-of-range values appears to be equivalent to “unspecified behavior” (not "undefined behavior"), using the C++ Standard terminology.
The trouble with that analogy is that it implicitly reminds me that this works deterministically from a local perspective.
Julia is far more dynamic than languages such as C++, which negates the expectation.

The NaN example is also misleading as it implies that it is locally deterministic.
However, "worse" examples such as unsafe_trunc(UInt8, -2.2) should not be there because the doctest fails.

I am not a good writer, so I will leave the editing to other reviewers.

@nsajko nsajko added the domain:docs This change adds or pertains to documentation label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants