Skip to content

Adding floating point considerations to tutorial - #8324

Merged
rossbar merged 6 commits into
networkx:mainfrom
amcandio:fp-considerations-tutorial
Oct 23, 2025
Merged

rossbar merged 6 commits into
networkx:mainfrom
amcandio:fp-considerations-tutorial

Conversation

@amcandio

@amcandio amcandio commented Oct 18, 2025 •

Copy link
Copy Markdown
Contributor

Floating Point Considerations

As discussed in previous issues and PRs (e.g., #4972, #4592, #8316), users sometimes face unexpected results when using floating point values such as edge weights or capacities. These issues are often caused by rounding errors, not bugs in the algorithms.

The moment floating point numbers are used, all results become approximate. So to avoid confusion, we update tutorial to clarify these considerations.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amcandio , I think this is a step in the right direction. One idea that occurred to me when considering how to better document numerical precision was to add a standard reference document (similar to what is done for seeding/randomness) and then link to this reference doc from the functions where precision issues are prominent.

That's too much for this PR though - I'm +1 for getting this information somewhere visible in the docs and this seems a sensible place to me!

One style nit - could we get the line limits down to something more reasonable (80 or 88 or 110 chars). In principle the linter should be doing this file is clearly not being picked up 🙃

Comment thread doc/tutorial.md Resolved
@amcandio

Copy link
Copy Markdown
Contributor Author

Thanks! I fixed the line length. We can add a more-detail doc like https://networkx.org/documentation/stable/reference/randomness.html in a separate PR.

Comment thread doc/tutorial.md Resolved

@dschult dschult left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amcandio

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amcandio !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

floating-point Issues that ultimate stem from numerical precision type: Documentation

Development

Successfully merging this pull request may close these issues.

3 participants