frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Too AI; Didn't Read

https://www.tai-dr.com/
78•rfonseca•1h ago•63 comments

Ollaya – Ollama for open-source, Jev-style decision models

https://ollaya.dev/
208•Ardakilic•3h ago•59 comments

Show HN: Jev Plays Pokémon Red

https://jev-pokemon.vercel.app/
73•pancomplex•7h ago•39 comments

Platform-independent SIMD in Go

https://go.dev/blog/simd-experiment
326•yurivish•9h ago•124 comments

Bug: Border radius has infected VSCode editor

https://github.com/microsoft/vscode/issues/338035
53•2Ucoder•2h ago•28 comments

Git-bug: Distributed, offline-first bug tracker embedded in Git

https://github.com/git-bug/git-bug
270•alentred•10h ago•91 comments

First Principles Thinking

https://sunilsadasivan.com/writing/first-principles-thinking/
185•sunils34•7h ago•81 comments

U.S. appeals court upholds designation of Anthropic as supply chain risk

https://www.cnbc.com/2026/09/25/pentagon-anthropic-ai-risk-appeals-court.html
313•cramer4next•6h ago•530 comments

Gravity seems holographic. What does that mean for reality?

https://www.quantamagazine.org/gravity-seems-holographic-what-does-that-mean-for-reality-20260925/
69•ibobev•6h ago•76 comments

Revealing the details of how OpenAI agents hacked Hugging Face

https://swarmtraces.org/
3•specked-citrus•30m ago•0 comments

Advice to a Beginning Graduate Student (2001)

https://www.cs.cmu.edu/~mblum/research/pdf/grad.html
41•nicoraga•2h ago•14 comments

Alan Kay: Shannon gave us a way of dealing with noisy channels [video]

https://www.youtube.com/watch?v=Cjntrqhn8pk
96•behoove•3h ago•21 comments

Show HN: Make math automatic with Mathy

https://gmays.com/making-math-automatic-with-mathy/
48•gmays•4d ago•4 comments

Remembering Johannes Doerfert

https://blog.llvm.org/posts/2026-09-24-rememberingjohannesdoerfert/
7•sdko•22h ago•0 comments

Browsers Situationship: When Browsers Agree but the Spec Doesn't

https://www.atbrakhi.dev/blog/browsers-situationship
5•cpeterso•1d ago•2 comments

Bwbach, My Guardian Goblin

https://robertmay.photography/journal/bwbach-my-guardian-goblin
17•robotmay•3d ago•10 comments

Rising sea destroys homes, erases beaches in California

https://www.reuters.com/business/environment/rising-sea-destroys-homes-erases-beaches-california-...
34•geox•1h ago•27 comments

Pentium II at 600Mhz with Voodoo 3 Emulated on 86Box with M6 Mac Mini

https://nyaa.sh/reviews/mac-mini-m6-emulation
256•hugh4life•14h ago•110 comments

How video games inspire great UX (2019)

https://jenson.org/games/
66•andsoitis•5d ago•9 comments

Ink and Switch interactive homepage

https://www.inkandswitch.com/
210•iFreilicht•11h ago•25 comments

Meta's Muse appears to use an OpenAI model labeled muse-special

https://mouse.dev/blog/muse-special/
74•Aeroi•3h ago•33 comments

Show HN: Doom or Bloom, map your AI worldview

https://www.doom-or-bloom.com
42•transitivebs•4h ago•32 comments

Factorio that you can touch

https://factorio.com/blog/post/fff-447
277•ibobev•7h ago•81 comments

What happens when you analyze your favorite college football team like the CIA?

https://www.cultivatelabs.com/posts/what-happens-when-you-analyze-college-football-like-the-cia
19•adam•7h ago•10 comments

Amiga Screens: A Primer

https://www.datagubbe.se/amscr/
115•msephton•14h ago•33 comments

Letterboxd Is Up for Sale, and A24, Sony and the New York Times Are Bidding

https://www.worldofreel.com/blog/2026/9/24/letterboxd-is-up-for-sale-and-a24-sony-and-the-new-yor...
46•crossroadsguy•2h ago•20 comments

Show HN: Whiteboard (YC W26) – An open-source IDE for thoughtful software design

https://github.com/devdotfast/whiteboard
388•sidharthkmenon•1d ago•128 comments

What About Rails?

https://jardo.dev/what-about-rails
287•jrochkind1•18h ago•186 comments

Typst makes big strides

https://lwn.net/Articles/1092993/
85•leephillips•5h ago•13 comments

Astronomer watches Starlink satellites sinking to build a 'planetary barometer'

https://www.theregister.com/science/2026/09/25/astronomer-watches-starlink-satellites-sinking-to-...
41•whh•3h ago•13 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.