frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Show HN: I replaced a $120k bowling center system with $1,600 in ESP32s

1994•section33•15h ago•207 comments

Moonshine: Lets you stream games from your PC to any device running Moonlight

https://github.com/hgaiser/moonshine
84•wertyk•6h ago•42 comments

LoRA Speedrun – a public wall-clock leaderboard for fine-tuning techniques

https://github.com/Saivineeth147/lora-speedrun
9•Vineeth147•1h ago•0 comments

Claude Code uses Bun written in Rust now

https://simonwillison.net/2026/Jul/19/claude-code-in-bun-in-rust/
465•tosh•20h ago•624 comments

Korg PS-3300 is back

https://www.korg.co.uk/blogs/updates/ps3300
25•Lio•5d ago•19 comments

Orion Browser by Kagi

https://orionbrowser.com/
145•sebjones•11h ago•91 comments

Power companies are using eminent domain to seize land for data centers

https://fortune.com/2026/07/19/data-center-eminent-domain-public-use/
55•1vuio0pswjnm7•2h ago•11 comments

What I learned selling 2,500 MIDI recorders: Hardware is not so hard

https://chipweinberger.com/articles/20260719-hardware-is-not-so-hard
459•chipweinberger•19h ago•209 comments

Claude Fable produced a counterexample to the Jacobian Conjecture

https://xcancel.com/__alpoge__/status/2079028340955197566
237•loubbrad•3h ago•127 comments

The Zen of Parallel Programming

https://smolnero.com/posts/the-zen-of-parallel-programming
147•edgar_ortega•5d ago•17 comments

Self-Powered Trailers Promise Leaner Freight Runs

https://spectrum.ieee.org/self-powered-trailers-freight-decarbonization
6•rbanffy•1w ago•0 comments

Minecraft: Java Edition now uses SDL3

https://www.minecraft.net/en-us/article/minecraft-26-3-snapshot-4
293•ObviouslyFlamer•18h ago•198 comments

Xiaomi-Robotics-1

https://robotics.xiaomi.com/xiaomi-robotics-1.html
4•ilreb•1h ago•0 comments

Who Is America's Homer?

https://www.plough.com/articles/who-is-americas-homer
61•samclemens•5d ago•144 comments

Biggest Probabilistic Computer Turns Noise into Answers

https://spectrum.ieee.org/biggest-probabilistic-computer
59•rbanffy•8h ago•9 comments

Bananas sprout in Rayleigh Garden UK after 15 years

https://www.bbc.com/news/articles/cvg8edqq5g5o
147•teleforce•16h ago•106 comments

11,700 Free Photos from John Margolies' Archive of Americana Architecture

https://www.openculture.com/2026/07/free-photos-from-john-margolies-archive-of-americana-architec...
48•gslin•4d ago•2 comments

Qwen 3.8

https://twitter.com/Alibaba_Qwen/status/2078759124914098291
841•nh43215rgb•21h ago•579 comments

HomeLab #1: MikroTik as a Home Router

https://justsomebody.dev/blog/mikrotik-home-router
90•rafal_opilowski•11h ago•82 comments

Big Tech Is Now Targeting Native American Land for Data Centers

https://www.nytimes.com/2026/07/09/us/data-centers-native-american-tribes.html
41•reaperducer•3h ago•12 comments

A new Intel Itanium (IA-64) emulator that boots Windows

https://raymii.org/s/blog/Intel_Itanium_IA-64-Emulator_that_boots_Windows.html
70•jandeboevrie•9h ago•62 comments

Talk: The Art of Braiding Algorithms

https://pgadey.ca/notes/talk-relatorium-2026/
36•surprisetalk•4d ago•0 comments

I joined the IndieWeb, here's what I learned

https://en.andros.dev/blog/0b8e451e/i-joined-the-indieweb-heres-what-i-learned/
182•andros•19h ago•92 comments

C64 Basic Dungeon Crawler: Goblin Attack (C64 Basic Part 8)

https://retrogamecoders.com/c64-basic-dungeon-part8/
66•ibobev•14h ago•4 comments

HMD Touch 4G

https://www.hmd.com/en_int/hmd-touch-4g
68•thisislife2•12h ago•68 comments

Cagire: Live Coding in Forth

https://cagire.raphaelforment.fr
89•surprisetalk•1w ago•11 comments

I burned all my tokens researching how to save tokens

https://quesma.com/blog/custom-deep-research-pipeline/
117•bkotrys•18h ago•154 comments

Dupes took over the world

https://www.vox.com/podcasts/493930/dupe-culture-fender-ugg-quince-tiktok-amazon-online-shopping
79•gumby•5d ago•73 comments

Big Tech Needs to Justify AI Spending as Investors Dump Stocks

https://www.bloomberg.com/news/articles/2026-07-19/big-tech-needs-to-justify-ai-spending-as-inves...
23•1vuio0pswjnm7•1h ago•8 comments

Terence McKenna's Mega Bad Trip (2025)

https://psychedelics.community/cultural-icons/terence-mckennas-mega-bad-trip
86•Dimmiwoah•15h ago•77 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.