-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add documentation for checked arithmetic operators with examples in F# #43789
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
Conversation
docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md
Outdated
Show resolved
Hide resolved
docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md
Show resolved
Hide resolved
docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md
Outdated
Show resolved
Hide resolved
|
Hi @T-Gro, since I am learning F#, Really appreciate if you can apply suggestions on the commit? :) |
The suggestions done now are good, thank you for incorporating that. I think it now makes it very clear what the default is and also when overflow+underflow can happen. Good job. |
|
Hi @BillWagner / @KathleenDollard, could you please have a look at the PR and merge? |
BillWagner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM @shethaadit
I'll
now.
Summary
Problem
The existing documentation only describes unchecked arithmetic operators, which do not throw exceptions on overflow, potentially leading to unintended behavior. Checked arithmetic operators were missing, and there was no guidance on handling overflow scenarios effectively.
Solution
This update introduces a new section on checked arithmetic operators in F#. It includes:
Microsoft.FSharp.Core.Operators.Checkedmodule.try...withexample for handlingSystem.OverflowException.Impact
This change improves the usability of the documentation by providing comprehensive guidance for developers who need overflow-safe arithmetic operations.
Fixes #41859
Internal previews