frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Laws of Software Engineering

https://lawsofsoftwareengineering.com
387•milanm081•4h ago•188 comments

As Oceans Warm, Great White Sharks Are Overheating

https://e360.yale.edu/digest/great-white-sharks-climate
37•speckx•44m ago•12 comments

Tim Cook's Impeccable Timing

https://stratechery.com/2026/tim-cooks-impeccable-timing/
109•hasheddan•4h ago•153 comments

Show HN: VidStudio, a browser based video editor that doesn't upload your files

https://vidstudio.app/video-editor
134•kolx•3h ago•53 comments

Fusion Power Plant Simulator

https://www.fusionenergybase.com/fusion-power-plant-simulator
26•sam•1h ago•9 comments

John Ternus to become Apple CEO

https://www.apple.com/newsroom/2026/04/tim-cook-to-become-apple-executive-chairman-john-ternus-to...
2073•schappim•18h ago•1170 comments

Show HN: GoModel – an open-source AI gateway in Go; 44x lighter than LiteLLM

https://github.com/ENTERPILOT/GOModel/
28•santiago-pl•1h ago•5 comments

Running a Minecraft Server and More on a 1960s Univac Computer

https://farlow.dev/2026/04/17/running-a-minecraft-server-and-more-on-a-1960s-univac-computer
76•brilee•3d ago•14 comments

A type-safe, realtime collaborative Graph Database in a CRDT

https://codemix.com/graph
84•phpnode•5h ago•28 comments

Tindie store under "scheduled maintenance" for days

https://www.tindie.com/
54•somemisopaste•2h ago•14 comments

MNT Reform is an open hardware laptop, designed and assembled in Germany

http://mnt.stanleylieber.com/reform/
169•speckx•1d ago•68 comments

Anthropic says OpenClaw-style Claude CLI usage is allowed again

https://docs.openclaw.ai/providers/anthropic
351•jmsflknr•11h ago•209 comments

Anthropic takes $5B from Amazon and pledges $100B in cloud spending in return

https://techcrunch.com/2026/04/20/anthropic-takes-5b-from-amazon-and-pledges-100b-in-cloud-spendi...
93•Brajeshwar•2h ago•95 comments

Your favorite brands got worse on purpose

https://www.worseonpurpose.com/p/your-favorite-brands-got-worse-on-purpose
28•neon_electro•1h ago•7 comments

Slava's Monoid Zoo

https://factorcode.org/slava/monoids.html
26•luu•1d ago•4 comments

Original GrapheneOS responses to WIRED fact checker

https://discuss.grapheneos.org/d/34369-original-grapheneos-responses-to-wired-fact-checker
4•ChrisArchitect•29m ago•0 comments

Leonardo, Borgia, and Machiavelli: A Fateful Collusion

https://www.historytoday.com/archive/leonardo-borgia-and-machiavelli-fateful-collusion
8•apollinaire•5d ago•0 comments

Salmon exposed to cocaine and its main byproduct roam more widely

https://www.science.org/content/article/cocaine-pollution-gives-salmon-wanderlust
94•1659447091•10h ago•56 comments

The Beauty of Bonsai Styles

https://longwoodgardens.org/blog/2023-05-17/beauty-bonsai-styles
150•lagniappe•11h ago•26 comments

A Roblox cheat and one AI tool brought down Vercel's platform

https://webmatrices.com/post/how-a-roblox-cheat-and-one-ai-tool-brought-down-vercel-s-entire-plat...
248•bishwasbh•11h ago•138 comments

Apple ignores DMA interoperability requests and contradicts own documentation

https://fsfe.org/news/2026/news-20260420-01.html
156•kirschner•4h ago•26 comments

Louis Zocchi, games industry pioneer, has died

https://icv2.com/articles/news/view/62176/r-i-p-louis-zocchi-the-godfather-dice
101•sgbeal•9h ago•48 comments

High-Fidelity KV Cache Summarization Using Entropy and Low-Rank Reconstruction

https://jchandra.com/posts/hae-ols/
42•jchandra•2d ago•7 comments

Qwen3.6-Max-Preview: Smarter, Sharper, Still Evolving

https://qwen.ai/blog?id=qwen3.6-max-preview
667•mfiguiere•1d ago•359 comments

My University Hired a Terrorist

https://www.facultyleaks.com/p/my-university-hired-terrorist
5•johndcook•1h ago•0 comments

The purist's guide to phở in Hanoi

https://connla.substack.com/p/pho-in-hanoi-a-purists-guide
72•vinhnx•2d ago•25 comments

How to make a fast dynamic language interpreter

https://zef-lang.dev/implementation
222•pizlonator•14h ago•41 comments

Less human AI agents, please

https://nial.se/blog/less-human-ai-agents-please/
63•nialse•8h ago•94 comments

Vera C. Rubin Observatory has Discovered 11,000 New Asteroids

https://www.universetoday.com/articles/the-vera-c-rubin-observatory-has-discovered-11000-new-aste...
34•tcp_handshaker•2h ago•4 comments

Scammer Used an AI-Generated MAGA Girl to Grift 'Super Dumb' Men

https://www.wired.com/story/ai-generated-maga-girls/
32•Aboutplants•52m ago•11 comments
Open in hackernews

Comparing floating-point numbers (2012)

https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
26•sph•11mo ago

Comments

LegionMammal978•11mo 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•11mo 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•11mo 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.