frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Bleached corals thrive within days when touching healthy neighbour

https://www.nature.com/articles/d41586-026-03266-x
146•alkyon•21h ago•20 comments

The Commodore 64 hardware simulator: break chips and pins, see the results

https://github.com/antirez/c64-hw-simulator
85•antirez•2d ago•15 comments

Chrome and Edge are removing XSLT: what breaks and what does not

https://doctor-seo.net/en/blog/news/chrome-edge-removing-xslt/
12•croes•41m ago•6 comments

Furifont, a Japanese font that shows furigana

https://furifont.antfu.me/
163•plaguna•2d ago•37 comments

Dam removals are bringing fish back across the northeastern United States

https://www.smithsonianmag.com/science-nature/dam-removals-are-bringing-fish-back-across-the-nort...
66•sohkamyung•21h ago•14 comments

Making chicken transparent using Dorito dust

https://chillphysicsenjoyer.substack.com/p/making-chicken-transparent-using
206•crescit_eundo•6h ago•59 comments

Source code of the Estonian online voting system

https://github.com/valimised/ivxv
94•theanonymousone•17h ago•64 comments

DeepSeek-v4.1-Flash-1017

https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash-1017
567•theykk•12h ago•510 comments

Pele – Mermaid diagrams as themeable SVG

https://pele.run/
84•dchest•4h ago•13 comments

Gold is now the top U.S. export

https://www.numismaticnews.net/gold-now-top-u-s-export
112•iamnothere•3h ago•55 comments

Microsoft and CMU Team Up to Train Early Career Software Engineers

https://www.cs.cmu.edu/news/2026/microsoft-cmu-praise
14•azhenley•2h ago•10 comments

Pattern Matching Beats Narrative Reasoning

https://blog.scottstevenson.net/p/pattern-matching-beats-narrative
16•tosh•2h ago•5 comments

Laser Fault Injection on a Budget: RP2350 Edition

https://courk.cc/rp2350-challenge-laser
13•gregsadetsky•2d ago•1 comments

Artie (YC S23) Is Hiring Enterprise AES and Senior Engineers

https://www.artie.com/careers
1•j-cheong•3h ago

Development statistics for the 7.2 kernel

https://lwn.net/Articles/1088776/
107•farlight•3h ago•81 comments

Solar surpasses nuclear power globally for first time

https://www.pv-magazine.com/2026/09/29/solar-surpasses-nuclear-power-globally-for-first-time/
391•xbmcuser•6h ago•236 comments

OpenCode Hacked: User credentials leaked

https://twitter.com/opencode/status/2111516673953935833
378•pranshuchittora•2h ago•66 comments

Show HN: High-quality duck audio synthesizer

https://celphase.github.io/duck-pond/
45•celphase•7h ago•12 comments

Vintage Cassettes: 1963-2010

http://vintagecassettes.com/
27•austinallegro•3d ago•2 comments

I Became a Citizen of Japan

https://www.derekwessman.com/blog-1/natural
64•luu•3h ago•14 comments

You could have invented transformers from memory

https://alexwang.ai/posts/associative-memory/
450•speckx•1d ago•107 comments

Show HN: Parin – A 2D game engine between raylib and Godot, written in Dlang

https://github.com/Kapendev/parin
23•Kapendev•1d ago•3 comments

Rendering pretty sky in Around The World game

https://frozenfractal.com/blog/2026/10/12/around-the-world-34-a-pretty-sky/
106•ibobev•1d ago•7 comments

A skeptic's first contact with Kubernetes (2024)

https://blog.davidv.dev/posts/first-contact-with-k8s/
49•pmoriarty•17h ago•10 comments

Show HN: Things to Do API

https://thingstodoapi.com/
23•invalidmonk•20h ago•6 comments

Show HN: Esp32sim – Run ESP32 firmware in the browser

https://github.com/mikroverk/esp32sim
82•joakimeriksson•6h ago•10 comments

A Tudor life in the time of plague (2020)

https://www.historytoday.com/archive/history-matters/tudor-life-time-plague
41•pepys•3d ago•3 comments

Show HN: Llmspeed – feel how fast a local LLM runs before you buy the hardware

https://llmspeed.dev/
218•albinstman•16h ago•75 comments

The future of programming (1982)

https://dl.acm.org/doi/10.1145/358453.358459
29•vismit2000•9h ago•7 comments

The First Candid

https://www.newyorker.com/magazine/2026/10/19/the-first-candid
37•Thevet•1d ago•8 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.