frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

SimCity, but with Permits

https://permit.petercai.com/
529•pcai•6h ago•277 comments

Feds suspect ransom negotiator ran ShinyHunters extortion site

https://krebsonsecurity.com/2026/10/feds-suspect-ransom-negotiator-ran-shinyhunters-extortion-site/
76•Bender•2h ago•18 comments

DeepInfer: High-performance inference framework for DeepSeek models

https://github.com/deepseek-ai/DeepInfer
2117•ggcr•15h ago•828 comments

Voxtral 3

https://mistral.ai/news/voxtral-3/
513•ilreb•8h ago•138 comments

The Other Epidemic: Trying to get off benzodiazepines

https://www.thebeliever.net/the-other-epidemic/
46•gaplong•1h ago•22 comments

What shall I teach my son?

https://stevekrouse.com/ends
248•Curiositry•7h ago•312 comments

Google open-sources TorchTPU, a native PyTorch back end for TPUs

https://github.com/google-pytorch/torch_tpu
253•ilreb•8h ago•59 comments

SlopCodeBench 10/2026 – Opus 5.5, Astra wins overall, xhigh considered harmful

https://github.com/humanlayer/advanced-context-engineering-for-coding-agents/blob/main/benchmarki...
156•dhorthy•5d ago•70 comments

Academics have a duty to defend open knowledge systems like Wikipedia

https://blogs.lse.ac.uk/impactofsocialsciences/2026/10/19/academics-have-a-duty-to-defend-open-kn...
112•jruohonen•6h ago•48 comments

Apple broke an essential presentation feature of iPads

https://teddysvoronos.com/2026-10-19-apple-broke-an-essential-presentation-feature-of-ipads/
481•evanb•12h ago•246 comments

Ofcom concedes defeat in 4chan case

https://prestonbyrne.com/2026/10/20/ofcom-concedes-defeat/
326•iamnothere•10h ago•242 comments

Sixteen Years After Deepwater Horizon, Deep Sea Life Shows Few Signs of Recovery

https://e360.yale.edu/digest/deepwater-horizon-deep-sea-recovery
178•speckx•8h ago•107 comments

EMudhra Intermediate CA Compromise

https://emudhra.we-have-a-problem.com/
609•galadran•10h ago•334 comments

Benchmarking Bot Detection Systems Against Modern AI Agents in 2026

https://research.poh.org/bot-benchmarking-2026/
21•mdahardy•7h ago•0 comments

Microagi: Accelerating Embodied AGI

https://www.microagi.ai/
4•doener•44m ago•1 comments

Making Solar Panels with a Microwave [video]

https://www.youtube.com/watch?v=zcWkApGjyGM
34•jackdoe•2d ago•4 comments

Tsrs: A Port of TypeScript to Rust

https://blog.cloudflare.com/typescript-rust-port/
338•hnisjafx40•11h ago•166 comments

Google Cloud outage affects almost all banking and other operations in Europe

https://www.neowin.net/news/google-cloud-outage-takes-down-hsbc-revolut-bank-of-scotland-llyods-e...
327•paweladamczuk•14h ago•166 comments

What the heck is /pkg?

https://anderegg.ca/2026/10/18/what-the-heck-is-pkg
55•GavinAnderegg•2d ago•15 comments

How I got over 300 Tor exit nodes removed

https://kaba.cx/posts/20261020_Tor/
314•kabakabakaba•11h ago•76 comments

Show HN: Dovepass – can I legally fly a drone along this exact path in SF?

https://dovepass.com
10•nimitmehra•1d ago•1 comments

IKEA – 3D Guide

https://sael.net/flatpack/
133•punnerud•9h ago•48 comments

Meta's GB{2,3}00 Cluster

https://engineering.fb.com/2026/10/19/data-center-engineering/inside-prometheus-meta-gigawatt-sca...
56•stokedmartin•1d ago•24 comments

Launch HN: Respan (YC W24) – Open-source Rust AI gateway built around plugins

43•Andydy25•9h ago•16 comments

My Friend Bob Cringely

https://tyma.com/my-cringe-story/
163•zinxq•10h ago•47 comments

JAXA is about to perform a Phobos sample return mission

https://www.science.org/content/article/audacious-space-heist-japan-aims-bring-home-bits-martian-...
89•Muhammad523•2d ago•19 comments

'Der Viener Schlinger': The meat cannon that launched 20k hot dogs

https://flatwaterfreepress.org/der-viener-schlinger-the-meat-cannon-that-launched-20000-hot-dogs/
87•NaOH•2d ago•52 comments

LabRobotBench v0.1: Benchmarking wet lab robotics

https://gamowlabs.com/lab-robot-bench-v0-1
7•wardbradt•1h ago•1 comments

2026 is an exciting year for the Rust compiler (and me)

https://yoyo-code.com/2026-is-exciting-year-for-rust-compiler-and-me/
153•panstromek•11h ago•77 comments

Facebook Pages require paid subscription to post more than two links per month

https://mastodon.gamedev.place/@AshleyGullen/117473851565913919
411•AshleysBrain•9h ago•374 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.