frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Half-Baked Product

https://weli.dev/blog/half-baked-product/
150•weli•2h ago•34 comments

Virginia bans sale of geolocation data

https://www.hunton.com/privacy-and-cybersecurity-law-blog/virginia-bans-sale-of-geolocation-data
817•toomuchtodo•13h ago•128 comments

Right to Local Intelligence

https://righttointelligence.org/
283•thoughtpeddler•11h ago•93 comments

CarPlay Is Additive

https://www.caseyliss.com/2026/7/2/carplay-is-additive-you-dolts
327•sprawl_•9h ago•428 comments

Wordgard: The new in-browser rich-text editor from the creator of ProseMirror

https://wordgard.net/
21•indy•2h ago•3 comments

Alibaba to ban Claude Code in workplace over alleged backdoor risks, source says

https://www.reuters.com/world/china/alibaba-ban-claude-code-workplace-over-alleged-backdoor-risks...
94•nsoonhui•2h ago•53 comments

crustc: entirety of `rustc`, translated to C

https://github.com/FractalFir/crustc
291•Philpax•12h ago•56 comments

How working with a blind client revealed invisible accessibility gaps

https://iinteractive.com/resources/blog/read-only
25•fortyseven•3d ago•6 comments

Since Linux 6.9, LUKS suspend stopped wiping disk-encryption keys from memory

https://mathstodon.xyz/@iblech/116769502749142438
483•IngoBlechschmid•19h ago•208 comments

The Safari MCP server for web developers

https://webkit.org/blog/18136/introducing-the-safari-mcp-server-for-web-developers/
108•coloneltcb•9h ago•23 comments

Podman v6.0.0

https://blog.podman.io/2026/07/introducing-podman-v6-0-0/
545•soheilpro•20h ago•212 comments

Reality has a surprising amount of detail (2017)

https://johnsalvatier.org/blog/2017/reality-has-a-surprising-amount-of-detail
280•vinhnx•5d ago•106 comments

Q&A with Micron's VP and GM of Memory

https://morethanmoore.substack.com/p/q-and-a-with-microns-vp-and-gm-of
6•zdw•2d ago•2 comments

Exapunks (2018)

https://www.zachtronics.com/exapunks/
298•yu3zhou4•16h ago•101 comments

Immich 3.0

https://github.com/immich-app/immich/discussions/29439
440•hashier•20h ago•222 comments

Quake in 13 Kilobytes (2021)

https://js13kgames.com/games/q1k3
44•mortenjorck•6d ago•5 comments

14× faster embeddings: how we rebuilt the ONNX path in Manticore

https://manticoresearch.com/blog/onnx-embeddings-speedup/
52•snikolaev•7h ago•9 comments

Underwater Suit-Wearing Cyborg Insect Capable of Diving and Terra-Aqua Travel

https://www.nature.com/articles/s41467-026-74235-1
45•gscott•3d ago•18 comments

An American Privacy Emergency

https://scottaaronson.blog/?p=9902
319•flowercalled•10h ago•96 comments

The short leash AI coding method for beating Fable

https://blog.okturtles.org/2026/07/short-leash-ai-method/
140•Riseed•15h ago•174 comments

A Special Wireless-Free Nikon Camera Is Publicly Available for the First Time

https://petapixel.com/2026/06/24/a-special-wireless-free-nikon-camera-is-publicly-available-for-t...
65•HardwareLust•1w ago•52 comments

Superpowers 6

https://blog.fsck.com/2026/06/15/Superpowers-6/
158•seahorseemoji•2d ago•62 comments

Postgres transactions are a distributed systems superpower

https://www.dbos.dev/blog/co-locating-workflow-state-with-your-data
184•KraftyOne•16h ago•80 comments

FoundationDB's Flow – Bringing Actor-Based Concurrency to C++11

https://apple.github.io/foundationdb/flow.html
73•sourdecor•20h ago•13 comments

Claude-real-video - any LLM can watch a video

https://github.com/HUANGCHIHHUNGLeo/claude-real-video
139•cortexosmain•15h ago•43 comments

Great Salt Lake Tracker – Grow the Flow

https://growtheflowutah.org/laketracker/
106•cfowles•15h ago•37 comments

Mystery identity of 'Green Boots' climber is finally solved after DNA test

https://www.dailymail.com/news/article-15943905/Mystery-identity-Green-Boots-climber-macabre-land...
112•FireBeyond•12h ago•76 comments

This is my attempt to get Vulkan going on NetBSD

https://github.com/segaboy/vulkan-netbsd
111•segaboy81•16h ago•30 comments

EFF letter to FTC on X consent order [pdf]

https://www.eff.org/deeplinks/2026/06/eff-and-allies-xs-ftc-petition-waive-privacy-violation-orde...
142•Terretta•15h ago•60 comments

Android Developer Verification: Threat masquerading as protection

https://f-droid.org/2026/07/01/adv-malware.html
1630•drewfax•1d ago•698 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.