frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Shopify is moving from React Native back to Swift and Kotlin

https://shopify.engineering/back-to-native
647•fnthawar2•8h ago•437 comments

More questions about whether researchers can trust OpenAI with unpublished math

https://mathstodon.xyz/@andreasthom/117240535270608201
563•pred_•16h ago•564 comments

The Deathray: A simple way for an untrusted site to freeze a Mac

https://auberon.xyz/blog/posts/deathray/
21•auberonedu•3h ago•3 comments

Cognition launches new SWE-2 model, Rivaling Fable 5.1 and GPT-Astra

https://cognition.com/blog/swe-2
333•seelos•7h ago•137 comments

OpenAI Agents API

https://developers.openai.com/api/docs/guides/agents-api/overview
67•aquir•3h ago•52 comments

Don't let anyone take away your big box of cables

https://blog.jim-nielsen.com/2026/hands-off-my-cables/
250•Brajeshwar•7h ago•203 comments

NASA Color Trick Was Meant for Mars. Now It's Unveiling Rock Art on Earth

https://gizmodo.com/this-nasa-color-trick-was-meant-for-mars-now-its-unveiling-rock-art-on-earth-...
240•gumby•7h ago•36 comments

OpenAI’s Navier-Stokes release included a Lean 4 formal proof

https://www.johndcook.com/blog/2026/09/09/formal-method-revolution/
108•ibobev•1h ago•102 comments

Music Theory for the 21st-Century Classroom

https://musictheory.pugetsound.edu/mt21c/MusicTheory.html
133•aanet•5h ago•61 comments

Proof of Capture: Apple Reference Image, but open source and using steganography

https://merybenavente.me/blog/proof-of-capture
42•merybenavente•3h ago•34 comments

Forgejo <=16.0.3 Critical RCE

https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/16.0.4.md
135•weierstass•7h ago•48 comments

Recursion into madness

https://blog.coredump.cx/p/recursion-into-madness
16•surprisetalk•3d ago•2 comments

Hitachi launches CO2 heat pump water heaters with solar-friendly tariff controls

https://www.pv-magazine.com/2026/09/07/hitachi-launches-co2-heat-pump-water-heaters-with-solar-fr...
275•thelastgallon•1d ago•214 comments

Show HN: Vertumnus – printable posters of farmers' market produce seasonality

https://vertumnus.fyi
18•perspectivezoom•2d ago•6 comments

Rust is tier-1 language at Microsoft

https://rustfoundation.org/media/guest-post-rust-is-tier-1-language-at-microsoft/
572•mmastrac•9h ago•312 comments

What happens when a GPU writes memory

https://blog.doubleword.ai/what-happens-when-a-gpu-writes-memory
30•ibobev•2d ago•1 comments

JEP 544: Ahead-of-Time Code Compilation

https://openjdk.org/jeps/544
63•Skinney•5h ago•24 comments

Neki

https://planetscale.com/blog/introducing-neki
186•simon_weber•7h ago•96 comments

Bodily Oddities

https://vester.si/bodily-oddities/
27•vesterde•2h ago•22 comments

Silicon Valley is transforming the military-industrial complex?

https://costsofwar.watson.brown.edu/paper/how-big-tech-and-silicon-valley-are-transforming-milita...
138•paimapi•7h ago•267 comments

Detecting and countering misuse of AI: September 2026

https://www.anthropic.com/threat-intelligence-report-september-2026
60•garo-pro•5h ago•122 comments

Douglas Hofstadter: Analogy as the Core of Cognition [video]

https://www.youtube.com/watch?v=n8m7lFQ3njk
124•tosh•4d ago•67 comments

iPhone Duo

https://www.apple.com/iphone-duo/
1403•thecosmicfrog•1d ago•2420 comments

What algorithm did Windows XP use to choose your initial user picture?

https://devblogs.microsoft.com/oldnewthing/20260909-00/?p=112683
334•soheilpro•14h ago•162 comments

Creativity is the new moat

https://www.inventbuild.studio/blog/genuine-creativity-is-your-new-moat
113•virgil_disgr4ce•4h ago•58 comments

Cognition's SWE-2 achieves 92.8 on Terminal-Bench 2.1

https://tokenstead.ai/models/swe-2
51•cdnsteve•6h ago•24 comments

List of references on Sony websites to players "owning" their digital games

https://consumerrights.wiki/w/Sony_PlayStation_digital_game_ownership_lawsuit
342•haunter•10h ago•115 comments

Stockfish 19

https://stockfishchess.org/blog/2026/stockfish-19/
260•atiedebee•3d ago•146 comments

Compute-efficient pretraining and scaling to trillion-parameter models

https://magic.dev/blog/pretraining#
107•ronfriedhaber•2d ago•60 comments

Schemy Lisp En DOS

https://sled.neocities.org/
77•AlexeyBrin•4d ago•17 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.