frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Ruff v0.16.0 – Significant new updates – 413 default rules up from 59

https://astral.sh/blog/ruff-v0.16.0
73•vismit2000•2h ago•13 comments

Elevated Errors for Opus 5

https://status.claude.com/incidents/zftg3gqkmv18
24•TimCTRL•1h ago•17 comments

GrapheneOS protections against data extraction from locked devices

https://discuss.grapheneos.org/d/40700-grapheneos-protections-against-data-extraction-from-locked...
98•Cider9986•5h ago•46 comments

A shell colon does nothing. Use it anyway

https://refp.se/articles/your-shell-and-the-magic-colon
224•olexsmir•21h ago•87 comments

An ESP32 based plane radar for my desk

https://blog.ktz.me/esp32-plane-radar/
165•alexktz•8h ago•34 comments

The new rules of context engineering for Claude 5 generation models

https://claude.com/blog/the-new-rules-of-context-engineering-for-claude-5-generation-models
349•mellosouls•14h ago•239 comments

DeepSeek pause fundraise after comments on compute gap to US leaked (transcript) [pdf]

https://github.com/demo-zexuan/liang-wenfeng-investor-meeting-2026-7-22/blob/master/%E6%A2%81%E6%...
164•oliculipolicula•11h ago•117 comments

Inflect-Micro-v2: complete voice in 9.36M parameters

https://huggingface.co/owensong/Inflect-Micro-v2
142•nateb2022•10h ago•11 comments

Show HN: I mapped every US golf course

https://golfcoursebrowser.com/
139•rickmf•8h ago•77 comments

Overloaded Overloading

https://powerfulpython.com/blog/overloaded-overloading/
19•redsymbol•3d ago•4 comments

Stinkpot: SQLite-backed shell history

https://tangled.org/oppi.li/stinkpot
71•nerdypepper•1d ago•22 comments

Cloudflare's new AI traffic options for customers

https://blog.cloudflare.com/content-independence-day-ai-options/
130•alphabetatango•12h ago•104 comments

Alien World Chemistry Found Inside Meteorite That Struck New Jersey Home

https://www.seti.org/news/alien-world-chemistry-found-inside-meteorite/
78•spzx•9h ago•23 comments

Some more things about Django I've been enjoying

https://jvns.ca/blog/2026/07/21/more-nice-django-things/
50•surprisetalk•4d ago•22 comments

Rethinking Legal Education in the AI Era

https://www.law.uchicago.edu/news/ai-strategy-statement
78•jjwiseman•2d ago•46 comments

Running a 28.9M parameter LLM on an $8 microcontroller

https://github.com/slvDev/esp32-ai
201•boveyking•16h ago•47 comments

Git rebase -I is not that scary

https://cachebag.sh/journal/interactive-rebasing/
75•vinhnx•10h ago•87 comments

DskDitto: Ultra-fast, parallel duplicate-file detector

https://github.com/jdefrancesco/dskDitto
25•ingve•4d ago•4 comments

What is happening to jobs? Separating AI hype from reality

https://siepr.stanford.edu/publications/policy-brief/what-really-happening-jobs-separating-ai-hyp...
103•pod_krad•12h ago•119 comments

LLM Usage in Debian: Three Proposals

https://www.debian.org/vote/2026/vote_002
165•zdw•15h ago•148 comments

JetZero

https://www.jetzero.aero
210•lisper•8h ago•169 comments

Clinical failure rates over the decades: yikes

https://www.science.org/content/blog-post/clinical-failure-rates-over-decades-yikes
107•EA-3167•12h ago•86 comments

No Stack Overflow, No Autocomplete: What Coding Felt Like in the 80s

https://comuniq.xyz/post?t=1439
11•01-_-•1h ago•11 comments

SIMD for Collision

https://box2d.org/posts/2026/07/simd-for-collision/
102•birdculture•3d ago•27 comments

Pip install Postgres – no Docker/Brew/apt

https://github.com/leontrolski/postgresql-testing
6•leontrolski•2d ago•2 comments

Systems and Delays

https://martin.janiczek.cz/2026/07/24/systems-and-delays.html
63•vinhnx•10h ago•14 comments

Show HN: I made some transistor animations

https://brandonli.net/semisim/animations
190•stunningllama•1d ago•24 comments

GM Backs Sodium Ion Batteries for U.S. Grid Storage

https://spectrum.ieee.org/sodium-ion-battery-peak-energy
181•rbanffy•13h ago•80 comments

Show HN: Brolly, a plain-text weather forecast site

https://brolly.sh/forecast/RWFP2qW8
197•jsax•17h ago•70 comments

Android may soon restrict on-device ADB

https://kitsumed.github.io/blog/posts/android-may-soon-restrict-on-device-adb/
941•shscs911•1d ago•459 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.