frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Moving our warehouse off DuckDB

https://posthog.com/blog/moving-off-duckdb
52•emschwartz•54m ago•23 comments

Ask HN: Who is hiring? (November 2026)

35•whoishiring•55m ago•33 comments

If you love a website, back it up

https://blog.mistys-internet.website/post/2026/10/29/if-you-love-a-website-back-it-up/
84•ingve•3h ago•19 comments

Show HN: Warsaw in voxels – an interactive 3D map of the city centre

https://p.migdal.pl/warsaw-vibe-voxel/
10•stared•31m ago•4 comments

We halved DNS build delay and cut memory use by 85%

https://blog.cloudflare.com/dns-targeted-zone-builds/
26•wondersky•2h ago•6 comments

GPT-Rosalind-6 System Card Addendum

https://deploymentsafety.openai.com/gpt-rosalind-6
22•gmays•2h ago•15 comments

LongCat-2.5: Native Multimodality for Agentic Tasks

https://longcat.ai/blog/longcat-2.5/
30•pretext•1h ago•12 comments

Postgres 19 is late because so many more bugs are being found now

http://rhaas.blogspot.com/2026/10/postgres-19-is-late-and-its-ais-fault.html
747•soheilpro•2d ago•450 comments

Show HN: I've updated my Linux System Call website and API

https://syscall.sh/
159•guitmz•7h ago•45 comments

WTF Ubuntu?

https://chalmovsky.com/posts/wtf-ubuntu
641•chalmovsky•2h ago•299 comments

Supermarket freezers across Europe hit by second suspected cyber-attack

https://www.theguardian.com/world/2026/nov/02/supermarket-freezers-across-europe-hit-by-second-su...
193•fergie•5h ago•283 comments

Grokipedia offers lessons in how AI can help Wikipedia

https://www.niemanlab.org/2026/11/elon-musks-grokipedia-is-littered-with-mistakes-but-wikipedia-c...
4•ibn_khaldun•41m ago•1 comments

Bones may release proteins that slow aging and extend life span

https://www.science.org/content/article/bones-may-release-proteins-slow-aging-and-extend-life-span
253•EA-3167•15h ago•90 comments

Show HN: VHS Camera – Run your camera or videos through a simulated VHS signal

https://fotojockovic.com/vhs
6•wookashin•48m ago•2 comments

Ask HN: Which TV do you recommend for privacy?

613•LecroJS•21h ago•730 comments

Why are Soviet math textbooks so hardcore in comparison to US textbooks? (2017)

https://www.quora.com/Why-are-Soviet-mathematics-physics-textbooks-so-insanely-hardcore-in-compar...
91•zenincognito•1h ago•115 comments

F/OSS Comics #13: BSD Unix, Part 3 – The Beginning of BSD Unix

https://fosscomics.com/posts/13.%20BSD%20Unix%20Part%203%20-%20The%20Beginning%20of%20BSD%20Unix/
189•joonehur•14h ago•24 comments

Mystery of 60-Second Fluctuations in Power Grids Solved

https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in...
233•_Microft•2d ago•103 comments

Show HN: HackerBooks – HackerTube, but for books mentioned on HN

https://hackerbooks.org
1755•roansh•1d ago•286 comments

Last night an AI agent performed brain surgery on a mouse

https://twitter.com/OcanaSantero/status/2115442964574908902
72•FacZap•4h ago•67 comments

Trigger.dev customer environment variables exposed

https://trigger.dev/blog/security-incident-nov-2026
153•anurag•15h ago•83 comments

Napping characteristics and incident dementia

https://academic.oup.com/biomedgerontology/article/81/10/glag208/8769491?login=false
21•bookofjoe•2h ago•11 comments

C64 Basic Dungeon Crawler: Stairs, Levels and Levelling Up (Part 11)

https://retrogamecoders.com/c64-basic-dungeon-part11/
4•ibobev•2h ago•1 comments

Wir müssen wissen – wir werden wissen

https://remy.wang/blog/hilbert.html
35•remywang•8h ago•9 comments

HackerTube: YouTube built from videos recommended by HN

https://karpathy.bearblog.dev/hacker-tube/
2765•karpathy•1d ago•613 comments

Anthropic reports $17B in Q3 revenue, commitments of $895B in revised S-1

https://www.cnbc.com/2026/11/02/anthropic-ant-s-1-quarter-financials.html
158•rebel•2h ago•158 comments

Nibnib: Image compression with extreme decompression speed

https://github.com/raphlinus/nibnib
179•raphlinus•3d ago•31 comments

China's First Frontier AI Export Controls: Mofcom Announcement No. 48

https://labs.cloudsecurityalliance.org/research/csa-research-note-china-ai-export-controls-announ...
140•jonnybgood•9h ago•76 comments

Tips for more effective fuzz testing with AFL++

https://nullprogram.com/blog/2025/02/05/
148•luu•5d ago•28 comments

Never Complain, Never Explain

https://en.wikipedia.org/wiki/Never_complain,_never_explain
118•gregsadetsky•5h ago•47 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.