frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Taking on CUDA with ROCm: 'One Step After Another'

https://www.eetimes.com/taking-on-cuda-with-rocm-one-step-after-another/
35•mindcrime•2h ago•34 comments

Bring Back Idiomatic Design

https://essays.johnloeber.com/p/4-bring-back-idiomatic-design
447•phil294•12h ago•224 comments

DIY Soft Drinks

https://blinry.org/diy-soft-drinks/
235•_Microft•8h ago•58 comments

Ask HN: What Are You Working On? (April 2026)

119•david927•8h ago•317 comments

Most people can't juggle one ball

https://www.lesswrong.com/posts/jTGbKKGqs5EdyYoRc/most-people-can-t-juggle-one-ball
225•surprisetalk•3d ago•78 comments

A Perfectable Programming Language

https://alok.github.io/lean-pages/perfectable-lean/
43•yuppiemephisto•3h ago•6 comments

I gave every train in New York an instrument

https://www.trainjazz.com/
198•joshuawolk•2d ago•38 comments

Google removes "Doki Doki Literature Club" from Google Play

https://bsky.app/profile/serenityforge.com/post/3mj3r4nbiws2t
277•super256•5h ago•127 comments

Show HN: Oberon System 3 runs natively on Raspberry Pi 3 (with ready SD card)

https://github.com/rochus-keller/OberonSystem3Native/releases
162•Rochus•11h ago•36 comments

The peril of laziness lost

https://bcantrill.dtrace.org/2026/04/12/the-peril-of-laziness-lost/
297•gpm•5h ago•101 comments

Show HN: boringBar – a taskbar-style dock replacement for macOS

https://boringbar.app/
216•a-ve•7h ago•134 comments

Uncharted island soon to appear on nautical charts

https://www.awi.de/en/about-us/service/press/single-view/unkartierte-insel-demnaechst-auf-seekart...
38•tannhaeuser•4h ago•13 comments

Tech valuations are back to pre-AI boom levels

https://www.apollo.com/wealth/the-daily-spark/tech-valuations-back-to-pre-ai-boom-levels
98•akyuu•2h ago•15 comments

Tell HN: docker pull fails in spain due to football cloudflare block

654•littlecranky67•12h ago•251 comments

Anthropic downgraded cache TTL on March 6th

https://github.com/anthropics/claude-code/issues/46829
469•lsdmtme•19h ago•362 comments

Seven countries now generate 100% of their electricity from renewable energy

https://www.the-independent.com/tech/renewable-energy-solar-nepal-bhutan-iceland-b2533699.html
482•mpweiher•11h ago•237 comments

Investigating How Long-Distance Couples Use Digital Games to Facilitate Intimacy

https://arxiv.org/abs/2505.09509
57•radeeyate•8h ago•14 comments

JVM Options Explorer

https://chriswhocodes.com/vm-options-explorer.html
171•0x54MUR41•14h ago•72 comments

Show HN: Claudraband – Claude Code for the Power User

https://github.com/halfwhey/claudraband
88•halfwhey•8h ago•28 comments

Happy Map

https://pudding.cool/2026/02/happy-map/
211•surprisetalk•5d ago•32 comments

Phyphox – Physical Experiments Using a Smartphone

https://phyphox.org/
185•_Microft•16h ago•30 comments

EasyPost (YC S13) Is Hiring

https://www.easypost.com/careers
1•jstreebin•8h ago

Mark's Magic Multiply

https://wren.wtf/shower-thoughts/marks-magic-multiply/
34•luu•1d ago•2 comments

Exploiting the most prominent AI agent benchmarks

https://rdi.berkeley.edu/blog/trustworthy-benchmarks-cont/
490•Anon84•1d ago•126 comments

A Tour of Oodi

https://blinry.org/oodi/
108•zdw•3d ago•35 comments

Cooperative Vectors Introduction

https://www.evolvebenchmark.com/blog-posts/cooperative-vectors-introduction
44•JasperBekkers•2d ago•2 comments

Doom, Played over Curl

https://github.com/xsawyerx/curl-doom
98•creaktive•15h ago•20 comments

European AI. A playbook to own it

https://europe.mistral.ai/
139•hjouneau•5h ago•79 comments

Textbooks and Methods of Note-Taking in Early Modern Europe (2008)

https://dash.harvard.edu/server/api/core/bitstreams/7312037d-e342-6bd4-e053-0100007fdf3b/content
24•mooreds•8h ago•0 comments

The Closing of the Frontier

https://tanyaverma.sh/2026/04/10/closing-of-the-frontier.html
168•MindGods•6h ago•107 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.