frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Holy shit holy shit holy shit holy shit: The magnitude of what’s now happening

https://scottaaronson.blog/?p=10379
1416•Kotlopou•13h ago•1237 comments

1Password Security Incident

https://1password.com/blog/update-on-nov-2026-security-incident
1379•lxhrstn•15h ago•581 comments

Lions' Commentary on Unix: Why It Was Secretly Copied for 20 Years

https://fosscomics.com/posts/17.%20Lions%27%20Commentary%20on%20Unix/
63•joonehur•3h ago•9 comments

Much shorter version of GRH Lean verification from Anthropic

https://github.com/lsernau/grh-lean
431•nb-t•10h ago•220 comments

Minipg: PostgreSQL as a Single Executable

https://progrium.github.io/minipg/
98•rguiscard•5h ago•15 comments

The New York Times warns photographers not to update Photoshop over AI features

https://www.theverge.com/ai-artificial-intelligence/1041227/the-new-york-times-warns-photographer...
346•rmason•11h ago•293 comments

Collection of preserved UI style guides

https://aresluna.org/ui-style-guides/
146•sohkamyung•7h ago•16 comments

Tell HN: Lots of Ask HNs again

245•dang•7h ago•90 comments

Show HN: Synth Patch Hero

https://swarkentin.github.io/synth-patch-hero/
23•kaidon•2d ago•7 comments

Moat: Your OpenRouter Replacement

https://commandcode.ai/moat
14•amanverasia•1h ago•11 comments

Slow Ubuntu security response times

https://www.openwall.com/lists/oss-security/2026/11/25/9
273•gslin•11h ago•121 comments

GPT-6.2 Astra is the first model to beat Googlers' code golf records

https://bjin.github.io/go-codegolf-benchmark/#leaderboard
359•bjin•3d ago•99 comments

The Great Automatic Grammatizator (By Roald Dahl), 1954 [pdf]

https://gwern.net/doc/fiction/science-fiction/1953-dahl-thegreatautomaticgrammatizator.pdf
74•Michelangelo11•3d ago•20 comments

What VP ≠ VNP Means (In 3 Minutes)

https://www.friedgil.com/vpvnp
114•vinhnx•1d ago•29 comments

OpenAI cuts GPT-6.2 usage: Astra hits limits 40% faster, Sol 25% faster

https://twitter.com/thsottiaux/status/2125784147889393806
192•Herrera•4h ago•95 comments

Qualcomm's Oryon 3 Reaches the Top

https://chipsandcheese.com/p/qualcomms-oryon-3-reaches-the-top
42•wmf•4h ago•11 comments

Bare Metal Qwen

https://github.com/alesha-pro/llm.asm/tree/main/02-baremetal-os
136•miohtama•10h ago•33 comments

'Castles' Review

https://www.wsj.com/arts-culture/books/castles-review-playing-defense-da10d776?st=tR9KT4&reflink=...
15•mr_tyzik•1d ago•3 comments

Nfs2root: A 12-year-old pre-auth remote root in the Linux kernel's NFS server

https://opensec.in/blog/nfs2root-cve-2026-99362
131•dm•11h ago•46 comments

How did pinwheel calculators work?

https://blog.coredump.cx/p/how-did-pinwheel-calculators-work
64•surprisetalk•1d ago•4 comments

Deploying a payphone on a tiny Pacific Island for fun and zero profit

https://nickvsnetworking.com/deploying-a-payphone-on-a-tiny-pacific-island-for-fun-and-zero-profit/
91•qzervaas•10h ago•12 comments

The history of civilization is the history of wheat

https://asteriskmag.com/issues/16/marginal-grains
17•NaOH•1d ago•0 comments

SSH is a GUI framework

https://zydra.sh/articles/ssh-is-a-gui-framework/
182•teledream•4d ago•89 comments

XKCD and Fourier

https://leancrew.com/all-this/2026/10/xkcd-and-fourier/
40•surprisetalk•1d ago•9 comments

The polynomial Hirsch conjecture is false [pdf]

https://github.com/openai/math/blob/main/preprints/Superpolynomial-graph-diameter-of-simple-polyt...
152•acossta•14h ago•41 comments

Can a TV be too large? An investigation

https://techcrunch.com/2026/11/22/can-a-tv-be-too-large-an-investigation/
55•jomon003•3d ago•75 comments

Deriving Black-Scholes

https://david.alvarezrosa.com/posts/deriving-black-scholes/
68•meysamazad•15h ago•46 comments

Hkust 3D Prints a Titanium Alloy That Keeps Hardening

https://3dprinting.com/news/hkust-researchers-3d-print-a-titanium-alloy-that-keeps-hardening-unde...
35•rbanffy•2d ago•6 comments

I checked Clojure's core with Lean and found unreported bugs

https://s.conao3.com/blog/2026/e4f733
218•encyclopedism•17h ago•75 comments

Mirror life is dangerous. Regulators must act before it becomes real

https://www.economist.com/leaders/2026/10/01/mirror-life-is-dangerous-regulators-must-act-before-...
38•trakkstar•1h ago•40 comments
Open in hackernews

Comparing floating-point numbers (2012)

https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
26•sph•1y ago

Comments

LegionMammal978•1y ago
I'd argue that any equality comparison of floating-point numbers is asking for trouble, unless you're specifically working with small dyadic fractions (using exact comparison) or testing a purely heuristic 'closeness' condition (using fuzzy comparison).

Of course, inequalities show up in a lot more places, but are similarly fraught with difficulty, since mathematical statements may fail to translate to floating-point inequalities. E.g., in computational geometry, people have written entire papers about optimizing correct orientation predicates [0], since the naive method can easily break at small angles. This sort of thing is what often shows up as tiny seams in 3D video-game geometry.

[0] https://www.cs.cmu.edu/~quake/robust.html

mtklein•1y ago
My preferred way to compare floats as being interchangeably equivalent in unit tests is

    bool equiv(float x, float y) {
        return (x <= y && y <= x)
            || (x != x && y != y);
    }
This handles things like ±0 and NaNs (while NaNs can't be IEEE-754-equal per se, they're almost always interchangeable), and convinces -Wfloat-equal you kinda know what you're doing. Also everything visually lines up real neat and tidy, which I find makes it easy to remember.

Outside unit tests... I haven't really encountered many places where float equality is actually what I want to test. It's usually some < or <= condition instead.

sph•1y ago
I have built a production Javascript library with decent amounts of users that incorporates the following hack to deal with float error (avert your eyes if you're sensitive):

  // 1.2 - 1.0 === 0.19999999999999996
  // fixFloatError(1.2 - 1.0) === 0.2
  var fixFloatError = function (n) {
    return parseFloat(n.toPrecision(12));
  };
It felt correct at the time, but after reading the article, I cringe at how fundamentally broken it is. I got away with it because the library is used to convert betting odds, which are mostly small floating point numbers, so the error is often < 10^-12.