frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

OpenSSH adds support for composite ML-DSA 87 / ECDSA p384

https://github.com/openssh/openssh-portable/commit/fc6f265302adcbf88c5b4273e9cc9f4e5f81ab94
262•weeha•7h ago•60 comments

Intel confirms Hyper-Threading flaw in several CPUs

https://tldrdailynews.com/news/technology/technology/intel-confirms-unfixable-hyper-threading-fla...
168•lucamark•5h ago•79 comments

MAI Transcribe 2.5: The new frontier of speech recognition

https://microsoft.ai/news/mai-transcribe-2-5/
288•gmays•9h ago•90 comments

How Hot Are Mitochondria?

https://matthewleighton.substack.com/p/how-hot-are-mitochondria
28•mleighton•4d ago•3 comments

Joint statement from Anthropic and OpenAI on recent advances in cryptography

https://www.anthropic.com/news/joint-statement-cryptography
1156•aghuang•20h ago•762 comments

Minisign 2 Is Here

https://00f.net/2026/12/04/minisign2/
114•chmaynard•6h ago•14 comments

Snakes can cartwheel, hilarious new slow-motion footage shows

https://www.sciencefocus.com/news/snakes-cartwheel-footage
207•ColinWright•4d ago•42 comments

Evidence for the Tomb of Alexander the Great at Alexandria's Shallalat Gardens

https://www.academia.edu/182065274/The_Sema_of_Alexandria_Archaeological_Architectural_and_Topogr...
74•tsaki•4d ago•4 comments

Gaia unveils two-billion-star map of our galaxy and beyond

https://www.esa.int/articles/about-us/directorates/science/gaia/gaia-unveils-two-billion-star-map...
222•rexbee•11h ago•88 comments

The bitter lesson for agent memory

https://hatchery.build/blog/the-bitter-lesson-for-agent-memory
392•tosh•13h ago•130 comments

The Busy Beaver Frontier (2020) [pdf]

https://www.scottaaronson.com/papers/bb.pdf
14•srcreigh•1d ago•2 comments

OpenBridge, a modern standard for industrial UIs

https://www.openbridge.no
360•starkparker•15h ago•83 comments

Stanford Lecture: Dr. Don Knuth – Claude and the Art of Computer Programming

https://www.youtube.com/watch?v=-1AajkwngqM
124•froh•2d ago•27 comments

The need for at least a third mobile OS option

https://blog.ovalerio.net/archives/3359
330•brazukadev•18h ago•274 comments

I gave Claude a $100 drone and some instructions

https://oleksgorpynich.com/blog/claude-drone
238•oleksg•14h ago•93 comments

Open Music Theory

https://viva.pressbooks.pub/openmusictheory/
197•gregsadetsky•11h ago•42 comments

Handling dates and times in SQL queries with PostgreSQL

https://www.mon-code.net/post/186/handling-dates-and-times-in-sql-queries-with-postgresql
11•metfan•3d ago•6 comments

Mistral Vibe: The coding agent for chonky codebases

https://mistral.ai/products/vibe/
437•doener•21h ago•152 comments

Linux 7.3 on a stock 4 MB Macintosh Plus

https://github.com/ActionRetro/nugget-linux
156•hochmartinez•12h ago•42 comments

WordPress Plugin WP Rocket CVE-2026-125812: Exploits in the Wild, Dissected

https://noc.org/articles/wp-rocket-vulnerability-exploit-cve-2026-125812
31•sucuri2•7h ago•18 comments

Yes, P-256 is probably cooked

https://www.int08h.com/post/how-cooked-are-your-keys/
357•int08h•19h ago•193 comments

Two-Photon Mesoscope

https://github.com/benkrasnow/Two_photon_mesoscope
71•tobr•4d ago•9 comments

Unlimited SVG Works: Projection of Visual Worlds into SVG-Anything

https://github.com/baidu/Unlimited-SVG/
96•tingletech•4d ago•10 comments

Plato's Key-a rotation and a global scale let an LLM use other's representations

https://hazyresearch.stanford.edu/blog/2026-11-25-platos-key
85•tomrod•11h ago•24 comments

Delete the Paper, Beat the Authors: Introducing FrontierCS 2 (Benchmark)

https://bair.berkeley.edu/blog/2026/12/03/fcs2/
14•charlie42•4h ago•9 comments

DKIM was introduced at a unlucky time; or, happy 20 years of CVE-2008-0166

https://dreamstation.systems/personal/dkimdebian.html
223•robinpie•18h ago•37 comments

They should be dead: how snow insects survive freezing temps

https://www.quantamagazine.org/they-should-be-dead-how-snow-insects-survive-freezing-temps-20261204/
33•titusblair•1d ago•4 comments

Claude Coke: Would Al agents buy cocaine from the dark web?

https://ghollbeck.github.io/claude-coke-blog/
97•flawn•13h ago•64 comments

Owls in Towels

https://owlsintowels.org/
541•jjgreen•1d ago•51 comments

Cryptography rumors are getting more specific

https://www.johndcook.com/blog/2026/12/05/dlp-attack/
226•christophetd•16h ago•148 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.