frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Turtletoy

https://turtletoy.net/
109•ustad•4d ago•16 comments

I failed to recreate the 1996 Space Jam website with Claude

https://j0nah.com/i-failed-to-recreate-the-1996-space-jam-website-with-claude/
403•thecr0w•13h ago•332 comments

Damn Small Linux

https://www.damnsmalllinux.org/
49•grubbs•5h ago•7 comments

Bag of words, have mercy on us

https://www.experimental-history.com/p/bag-of-words-have-mercy-on-us
141•ntnbr•8h ago•140 comments

Dollar-stores overcharge customers while promising low prices

https://www.theguardian.com/us-news/2025/dec/03/customers-pay-more-rising-dollar-store-costs
353•bookofjoe•16h ago•489 comments

Truemetrics (YC S23) Is Hiring

https://www.ycombinator.com/companies/truemetrics/jobs/1EHTSyT-python-software-engineer-analystic...
1•Jan-Truemetrics•8m ago

Mechanical power generation using Earth's ambient radiation

https://www.science.org/doi/10.1126/sciadv.adw6833
103•defrost•9h ago•34 comments

The C++ standard for the F-35 Fighter Jet [video]

https://www.youtube.com/watch?v=Gv4sDL9Ljww
235•AareyBaba•13h ago•239 comments

Google Titans architecture, helping AI have long-term memory

https://research.google/blog/titans-miras-helping-ai-have-long-term-memory/
460•Alifatisk•18h ago•152 comments

Emacs is my new window manager

https://www.howardism.org/Technical/Emacs/new-window-manager.html
13•gpi•2d ago•2 comments

Work disincentives hit the near-poor hardest (2022)

https://www.niskanencenter.org/work-disincentives-hit-the-near-poor-hardest-why-and-what-to-do-ab...
72•folump•5d ago•42 comments

Uninitialized garbage on ia64 can be deadly (2004)

https://devblogs.microsoft.com/oldnewthing/20040119-00/?p=41003
56•HeliumHydride•3d ago•27 comments

An Interactive Guide to the Fourier Transform

https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/
188•pykello•6d ago•26 comments

Solving Rush Hour, the Puzzle (2018)

https://www.michaelfogleman.com/rush/
8•xeonmc•1w ago•1 comments

Scala 3 slowed us down?

https://kmaliszewski9.github.io/scala/2025/12/07/scala3-slowdown.html
208•kmaliszewski•16h ago•129 comments

The Anatomy of a macOS App

https://eclecticlight.co/2025/12/04/the-anatomy-of-a-macos-app/
219•elashri•18h ago•59 comments

How I block all online ads

https://troubled.engineer/posts/no-ads/
158•StrLght•8h ago•127 comments

CATL expects oceanic electric ships in 3 years

https://cleantechnica.com/2025/12/05/catl-expects-oceanic-electric-ships-in-3-years/
98•thelastgallon•1d ago•98 comments

I wasted years of my life in crypto

https://twitter.com/kenchangh/status/1994854381267947640
141•Anon84•18h ago•204 comments

Build a DIY magnetometer with a couple of seasoning bottles

https://spectrum.ieee.org/listen-to-protons-diy-magnetometer
81•nullbyte808•1w ago•17 comments

Nested Learning: A new ML paradigm for continual learning

https://research.google/blog/introducing-nested-learning-a-new-ml-paradigm-for-continual-learning/
109•themgt•16h ago•2 comments

Vibe Coding: Empowering and Imprisoning

https://www.anildash.com/2025/12/02/vibe-coding-empowering-and-imprisoning/
51•zdw•5d ago•36 comments

A two-person method to simulate die rolls (2023)

https://blog.42yeah.is/algorithm/2023/08/05/two-person-die.html
60•Fraterkes•2d ago•34 comments

Minimum Viable Arduino Project: Aeropress Timer

https://netninja.com/2025/12/01/minimum-viable-arduino-project-aeropress-timer/
31•surprisetalk•5d ago•17 comments

Show HN: Cdecl-dump - represent C declarations visually

https://github.com/bbu/cdecl-dump
17•bluetomcat•6h ago•8 comments

The state of Schleswig-Holstein is consistently relying on open source

https://www.heise.de/en/news/Goodbye-Microsoft-Schleswig-Holstein-relies-on-Open-Source-and-saves...
539•doener•17h ago•247 comments

Estimates are difficult for developers and product owners

https://thorsell.io/2025/12/07/estimates.html
189•todsacerdoti•11h ago•193 comments

Java Hello World, LLVM Edition

https://www.javaadvent.com/2025/12/java-hello-world-llvm-edition.html
173•ingve•19h ago•67 comments

Spinlocks vs. Mutexes: When to Spin and When to Sleep

https://howtech.substack.com/p/spinlocks-vs-mutexes-when-to-spin
68•birdculture•6h ago•15 comments

Palantir Could Be the Most Overvalued Company That Ever Existed

https://247wallst.com/investing/2025/11/25/palantir-could-be-the-most-overvalued-company-that-eve...
26•Anon84•2h ago•5 comments
Open in hackernews

Comparing floating-point numbers (2012)

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

Comments

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