frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Comparing floating-point numbers (2012)

https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
26•sph•9mo ago

Comments

LegionMammal978•9mo 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•9mo 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•9mo 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.

Discord/Twitch/Snapchat age verification bypass

https://age-verifier.kibty.town/
509•JustSkyfall•6h ago•219 comments

Using an engineering notebook

https://ntietz.com/blog/using-an-engineering-notebook/
57•evakhoury•2d ago•15 comments

“Nothing” is the secret to structuring your work

https://www.vangemert.dev/blog/nothing
145•spmvg•3d ago•47 comments

Fluorite – A console-grade game engine fully integrated with Flutter

https://fluorite.game/
429•bsimpson•12h ago•247 comments

Text classification with Python 3.14's ZSTD module

https://maxhalford.github.io/blog/text-classification-zstd/
148•alexmolas•2d ago•20 comments

Kanchipuram Saris and Thinking Machines

https://altermag.com/articles/kanchipuram-saris-and-thinking-machines
74•trojanalert•4d ago•11 comments

GLM-5: Targeting complex systems engineering and long-horizon agentic tasks

https://z.ai/blog/glm-5
307•CuriouslyC•15h ago•416 comments

Reports of Telnet's death have been greatly exaggerated

https://www.terracenetworks.com/blog/2026-02-11-telnet-routing
75•ericpauley•8h ago•22 comments

From 34% to 96%: The Porting Initiative Delivers – Hologram v0.7.0

https://hologram.page/blog/porting-initiative-delivers-hologram-v0-7-0
18•bartblast•5h ago•2 comments

The Problem with LLMs

https://www.deobald.ca/essays/2026-02-10-the-problem-with-llms/
21•vinhnx•2h ago•12 comments

NetNewsWire Turns 23

https://netnewswire.blog/2026/02/11/netnewswire-turns.html
248•robin_reala•10h ago•57 comments

Deobfuscation and Analysis of Ring-1.io

https://back.engineering/blog/04/02/2026/
11•raggi•3d ago•2 comments

Ireland rolls out basic income scheme for artists

https://www.reuters.com/world/ireland-rolls-out-pioneering-basic-income-scheme-artists-2026-02-10/
193•abe94•12h ago•198 comments

Show HN: Agent framework that generates its own topology and evolves at runtime

https://github.com/adenhq/hive/blob/main/README.md
65•vincentjiang•9h ago•19 comments

WiFi Could Become an Invisible Mass Surveillance System

https://scitechdaily.com/researchers-warn-wifi-could-become-an-invisible-mass-surveillance-system/
324•mgh2•5d ago•156 comments

Covering electricity price increases from our data centers

https://www.anthropic.com/news/covering-electricity-price-increases
63•ryanhn•7h ago•27 comments

Claude Code is being dumbed down?

https://symmetrybreak.ing/blog/claude-code-is-being-dumbed-down/
816•WXLCKNO•10h ago•543 comments

GPT-5 outperforms federal judges in legal reasoning experiment

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6155012
205•droidjj•5h ago•149 comments

Show HN: CodeRLM – Tree-sitter-backed code indexing for LLM agents

https://github.com/JaredStewart/coderlm/blob/main/server/REPL_to_API.md
27•jared_stewart•15h ago•14 comments

Heroku is not dead

https://nombiezinja.com/word-things/2026/2/8/heroku-is-not-dead
28•jbm•4h ago•23 comments

Microwave Oven Failure: Spontaneously turned on by its LED display (2024)

https://blog.stuffedcow.net/2024/06/microwave-failure-spontaneously-turns-on/
80•arm•9h ago•30 comments

GLM-OCR – A multimodal OCR model for complex document understanding

https://github.com/zai-org/GLM-OCR
242•ms7892•4d ago•71 comments

Sekka Zusetsu: A Book of Snowflakes (1832)

https://publicdomainreview.org/collection/japanese-snowflake-book/
23•prismatic•3d ago•3 comments

Amazon Ring's lost dog ad sparks backlash amid fears of mass surveillance

https://www.theverge.com/tech/876866/ring-search-party-super-bowl-ad-online-backlash
494•jedberg•10h ago•266 comments

Show HN: Agent Alcove – Claude, GPT, and Gemini debate across forums

https://agentalcove.ai
43•nickvec•8h ago•14 comments

Hacking the last Z80 computer – FOSDEM 2026 [video]

https://fosdem.org/2026/schedule/event/FEHLHY-hacking_the_last_z80_computer_ever_made/
35•michalpleban•4d ago•2 comments

Apple's latest attempt to launch the new Siri runs into snags

https://www.bloomberg.com/news/articles/2026-02-11/apple-s-ios-26-4-siri-update-runs-into-snags-i...
52•petethomas•9h ago•56 comments

Officials Claim Drone Incursion Led to Shutdown of El Paso Airport

https://www.nytimes.com/2026/02/11/us/faa-el-paso-flight-restrictions.html
342•edward•19h ago•544 comments

We rendered and embedded one million CAD files

https://cad-search-three.vercel.app/
111•DavidFerris•1d ago•43 comments

Show HN: Double blind entropy using Drand for verifiably fair randomness

https://blockrand.net/live.html
11•rishi_blockrand•2h ago•11 comments