frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Kimi-K3 Releases on HuggingFace 7/27

https://huggingface.co/moonshotai/Kimi-K3
405•nateb2022•4h ago•176 comments

PGSimCity - How PostgreSQL Works

https://nikolays.github.io/PGSimCity/
661•jonbaer•10h ago•65 comments

The Birth of the American 12-string Guitar

https://www.harpguitars.net/history/grunewald/12-string.htm
5•bilegeek•25m ago•0 comments

Show HN: Physically accurate black hole you can put in your room

https://blackhole.plav.in
343•aplavin•3d ago•104 comments

Magnolias Are So Old That They're Pollinated by Beetles, Not Bees

https://mymodernmet.com/magnolia-ancient-flowers-beetles/
58•speckx•4d ago•18 comments

Libsm64: Mario 64 as a library for use in external game engines

https://github.com/libsm64/libsm64
12•klaussilveira•1h ago•2 comments

Chinese chipmaker shares surge 470%

https://www.bbc.com/news/articles/c9q9w3x9qn2o
54•pingou•2h ago•33 comments

Scriptc by Vercel: TypeScript-to-Native compiler, no JavaScript engine in binary

https://github.com/vercel-labs/scriptc
205•maxloh•12h ago•105 comments

French firefighters face 'pyrocumulonimbus' for first time

https://www.france24.com/en/live-news/20260726-french-firefighters-face-pyrocumulonimbus-for-firs...
399•saaaaaam•17h ago•275 comments

Decker, a platform that builds on the legacy of Hypercard and classic macOS

https://beyondloom.com/decker/
324•tosh•16h ago•74 comments

US citizen charged after GrapheneOS phone wipes during airport search

https://www.techspot.com/news/113236-us-prosecutors-charge-atlanta-man-after-grapheneos-phone.html
839•eecc•12h ago•621 comments

We have proof automation now

https://www.imperialviolet.org/2026/07/26/zstd-lean.html
181•zdw•14h ago•69 comments

How Unix spell ran in 64 kB of RAM

https://blog.codingconfessions.com/p/how-unix-spell-ran-in-64kb-ram
39•donw•2h ago•3 comments

Htmx 4.0, the first JavaScript library to release exclusively on the Game Boy

https://swag.htmx.org/en-cad/products/htmx-4-the-game
464•rcy•23h ago•154 comments

I wanted a clock that never needed setting. Things escalated

https://arstechnica.com/gadgets/2026/07/i-wanted-a-clock-that-never-needed-setting-things-escalated/
120•lee_ars•3d ago•104 comments

Introduction to Data-Oriented Design [pdf]

https://www.gamedevs.org/uploads/introduction-to-data-oriented-design.pdf
186•tosh•17h ago•50 comments

Shay Locomotives

https://www.shaylocomotives.com/
4•Rygian•1h ago•0 comments

Fonts In Use – Find out where a font is used

https://fontsinuse.com/
78•open_•11h ago•9 comments

Measuring developer productivity with the DX Core 4

https://getdx.com/research/measuring-developer-productivity-with-the-dx-core-4/
22•saikatsg•3d ago•15 comments

Modern email can be built from borrowed parts

https://en.andros.dev/blog/d7ed8b07/modern-email-can-be-built-from-borrowed-parts/
5•andros•2h ago•2 comments

Boox Go 10.3 (gen II) Lumi: First impressions

https://manualdousuario.net/en/boox-go-10-3-lumi-first-impressions/
11•rpgbr•4d ago•2 comments

Elevated errors on Claude Opus 5

https://status.claude.com/incidents/lhqp09kxq7pb
6•flyaway123•2h ago•2 comments

Simulate cassette tape audio profiles using FFmpeg

https://github.com/AARomanov1985/Audio-Cassette-Simulation
139•xterminal•15h ago•58 comments

VLC for Unity now supported on Linux

https://code.videolan.org/videolan/vlc-unity
10•martz•2h ago•1 comments

The Usefulness of Useless Knowledge (1939) [pdf]

https://faculty.lsu.edu/kharms/files/flexner_1939.pdf
87•jxmorris12•3d ago•4 comments

Design is compromise

https://stephango.com/design-is-compromise
262•ankitg12•19h ago•88 comments

Show HN: CheapSecurity – Lightweight, Self-Hosted CCTV for Linux SBCs

https://github.com/gmrandazzo/CheapSecurity
131•zeldone•19h ago•27 comments

Show HN: Reverse Minesweeper

https://sunflowersgame.com/
229•pompomsheep•22h ago•79 comments

8086 Emulator Inside Scratch

https://turbowarp.org/1248315967?size=640x400
7•rickcarlino•4d ago•1 comments

Go Analysis Framework: modular static analysis by go team

https://pkg.go.dev/golang.org/x/tools/go/analysis
212•AbuAssar•22h ago•72 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.