frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Norway makes shithouses great again

https://www.visitnorway.com/plan-your-trip/travel-tips-a-z/norwegian-scenic-routes/worlds-best-to...
257•giuliomagnifico•2h ago•111 comments

HackerTube: YouTube built from videos recommended by HN

https://karpathy.bearblog.dev/hacker-tube/
1486•karpathy•16h ago•402 comments

A tiny Pacific country rolls out universal basic income

https://www.economist.com/asia/2026/10/29/a-tiny-pacific-country-rolls-out-universal-basic-income
54•motionlessveloc•2h ago•25 comments

An Italian farmer found some unknown seeds in his attic and planted them

https://www.smithsonianmag.com/science-nature/italian-farmer-found-unknown-seeds-attic-with-nothi...
519•ecares•14h ago•163 comments

Domain hacks with unusual Unicode characters (2018)

https://xn--69f31l4t57c0mag4b613h.xn--7uh4898msjaso/🆆🆃🅵/
19•n_plus_1_acc•2h ago•10 comments

Brazilian Court Sanctions Lawyers for Prompt Injection in Court Filing

https://jetstream.security/insights/brazilian-court-sanctions-prompt-injection-filing/
164•doodlesdev•10h ago•69 comments

TCP Use-After-Free: CVE-2026-98432 / CVSS 9.8

https://atlasum.net/blog/cve-2026-98432-linux-ipv4-tcp-uaf
551•oger•17h ago•255 comments

Running a bootstrapped SaaS for 20 years with my brother

https://blog.zamzar.com/2026/10/30/20-years-766-million-files-two-chameleons/
134•whyleyc•1d ago•32 comments

Memdoor: A team of 5 Qwen3.8-27B models beats Fable 5 on LiveCodeBench Hard

https://github.com/guregodevo/memdoor/tree/main/examples/workflows/team-solve
282•guregodevo•14h ago•129 comments

Show HN: Point your camera at a landscape to learn about its geology

https://outcrop.rocks/
28•headsupernova•2d ago•5 comments

Leaking Secrets from Air-Gap Computers by Spelling Radio Signals from RAM (2024)

https://arxiv.org/abs/2409.02292
104•hapax_legomena•11h ago•55 comments

The Ocean 'Was the Color of Chocolate.' Mexico Declares War on Seaweed.

https://www.nytimes.com/2026/10/28/world/americas/mexico-seaweed-navy.html
15•bookofjoe•23h ago•10 comments

The AI cost of JavaScript frameworks

https://nolanlawson.com/2026/10/28/the-ai-cost-of-javascript-frameworks/
125•luu•6h ago•77 comments

Radiation Map of the World

https://radiaverse.com/
4•slater•3d ago•1 comments

Understanding Email Encryption

https://www.fastmail.com/blog/email-encryption/
39•nmjenkins•1d ago•11 comments

No AI, 52 min. Build all Linux Files utils in C by Hand [video]

https://www.youtube.com/watch?v=gQRmSlcTq9c
67•surprisetalk•2d ago•55 comments

Altoids Project

https://uvdn7.github.io/altoids-project/
122•uvdn7•13h ago•7 comments

Zinc creep in cable spelter sockets brought down the Arecibo telescope in 2020

https://maketecheasier.com/arecibo-zinc-creep-collapse/
130•ohjeez•1d ago•38 comments

Pilot-wave hydrodynamics (Quantum phenomena in macroscopic hydrodynamic systems)

http://thales.mit.edu/bush/index.php/4801-2/
56•peter_d_sherman•1d ago•11 comments

It's the memory latency, stupid

https://pivotlake.io/blog/its-the-memory-latency-stupid/
215•ntur1337•18h ago•70 comments

A 1580 Map Shows Why Data Visualization Is Never Neutral

https://thereader.mitpress.mit.edu/a-1580-map-shows-why-data-visualization-is-never-neutral/
55•the-mitr•1d ago•4 comments

Sam Altman says DRAM capacity should go to data centers, not personal computers

https://www.tomshardware.com/tech-industry/data-centers/openai-ceo-says-its-quite-terrible-for-yo...
31•0x4e•2h ago•33 comments

A brief history of just-in-time: forty years of JIT work, from 1960–2000

https://dl.acm.org/doi/10.1145/857076.857077
36•gjvc•2d ago•0 comments

Electrification Could Cut Global Energy Use in Half

https://fullycharged.show/podcasts/podcast-361-why-electrification-could-cut-global-energy-use-in...
140•toomuchtodo•17h ago•69 comments

Jepsen: ParticleDB 1.1.4

https://jepsen.io/analyses/particledb-1.1.4
284•aphyr•23h ago•162 comments

ChatGPT and Codex usage limits merging

https://help.openai.com/en/articles/20001625-understanding-chatgpt-and-codex-usage-limits
173•Zariel•15h ago•108 comments

noyb win: French electronics retailer Fnac Darty fined €7M

https://noyb.eu/en/noyb-win-french-electronics-retailer-fnac-darty-fined-eu7-million
17•latexr•1h ago•3 comments

Do the math: How we took over ChatGPT accounts

https://www.parameter.ai/labs/we-found-a-gap-at-openai
344•armcat•1d ago•168 comments

Surviving "The Graduate"

https://www.newyorker.com/culture/the-weekend-essay/dustin-hoffman-on-surviving-the-graduate
132•samizdis•16h ago•39 comments

Simple circuits can create complex behaviors

https://aatishb.com/myriad/lets-build-a-brain/
271•aatish•4d ago•80 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.