frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Java4Shell: RCE in OpenJDK when processing Base64

https://calif.io/java4shell/
476•werrett•3h ago•129 comments

GPT‑6.2 Astra and Sol

https://openai.com/index/introducing-gpt-6-2-astra-sol/
1066•jasondavies•7h ago•680 comments

Quad9's withdrawal from France: A canary in the coal mine

https://blog.cloudflare.com/quad9-withdrawal-from-france/
238•subset•2h ago•66 comments

Archive Team is archiving the Apple Support Community (closes November 20, 2026)

https://wiki.archiveteam.org/index.php/Apple_Discussions
48•digitaldragon•1h ago•12 comments

Nvidia stopped disclosing Singapore sales as revenues hit $104B

https://www.ft.com/content/dbde7a30-548c-4f9d-a4be-7898a0c24dcf
377•louiereederson•7h ago•183 comments

jQuery 4.1.0

https://github.com/jquery/jquery/releases/tag/4.1.0
244•petecooper•5h ago•134 comments

Microsoft's ONNX Runtime has disappeared from GitHub

https://github.com/microsoft/onnxruntime
87•nvader•1h ago•19 comments

MAI Code 2 and Code 2 Flash

https://microsoft.ai/news/introducing-mai-code-2-and-mai-code-2-flash/
278•lemonish97•6h ago•131 comments

Phrack 73 Released

https://phrack.org/issues/73/introduction_md
262•notmine1337•6h ago•29 comments

Google's AI answers reducing search traffic by 40%

https://revscope.co/blog/search-seo-geo-2026/
16•slashdev•46m ago•6 comments

Highly classified US national security communications network goes down

https://www.cnn.com/2026/11/17/politics/highly-classified-national-security-communications-networ...
456•monkeydust•9h ago•541 comments

350 years ago, Ole Rømer discovered that light has a finite speed

https://www.sciencenorway.no/culture-history-history-of-science/350-years-ago-this-man-discovered...
232•dxs•5h ago•72 comments

Solid 2.0

https://www.solidjs.com/blog/solid-2-0-the-long-hold/
215•pier25•6h ago•56 comments

ID.me terms required for IRS sign-in

https://consumerrights.wiki/w/ID.me_terms_required_for_IRS_sign-in
7•DeepLogin•13m ago•0 comments

Launch HN: StarSling (YC P25) – Self-improving CI for agent-volume repos

https://starsling.dev
52•yonasb•6h ago•28 comments

What is the best harness for each model?

https://runta.com/blog/introducing-frontierharness-eval-v1-1/
332•Edward40•10h ago•114 comments

Web Browser Engineering (2021)

https://browser.engineering/
115•ibobev•5h ago•20 comments

Apple Services Down

https://developer.apple.com/system-status/
619•willy_k•7h ago•344 comments

Harvard researchers find AI coding agents shifted the bottleneck to code review

https://complexdiscovery.com/harvard-researchers-find-ai-coding-agents-shifted-the-bottleneck-to-...
32•judahmeek•3h ago•61 comments

Tencent Hy4 Flash

https://hy.tencent.ai/research/hy4-flash
42•lyra1337•3h ago•9 comments

Effects of a Nuclear Detonation in Low Earth Orbit

https://arxiv.org/abs/2611.09827
72•PaulHoule•5h ago•43 comments

YC wrote software to run our internship expo – and an 8-bit SIM to show it off

1•ryankicks•8h ago

Munich Laser Emits a Beam of Matter Waves (1999)

https://www.sciencedaily.com/releases/1999/03/990317060831.htm
8•peter_d_sherman•2d ago•3 comments

Who Builds the Machines That Build the Machines?

https://read.corematter.com/p/section-232-us-machine-tools
90•gmays•7h ago•28 comments

Not Everything Needs an LLM

https://newsletter.posthog.com/p/decision-models
89•speckx•6h ago•37 comments

Mouse Party

https://aboard.com/lets-have-a-mouse-party/
58•bookofjoe•3d ago•10 comments

Latent Lattice Language Models

https://shivamduggal4.github.io/latent-lattice-language-models/
15•E-Reverance•2h ago•3 comments

How the Claude Code team thinks about verification

https://claude.dev/blog/how-the-claude-code-team-thinks-about-verification/
261•craigmart•14h ago•202 comments

New Evidence Shows School Phone Bans Are Gradually Improving Test Scores

https://www.nytimes.com/2026/11/17/upshot/school-phone-bans-study-scores.html
1149•donohoe•13h ago•575 comments

Show HN: Alloy CSS, dialogs, menus and tabs that work with JavaScript off

https://alloyhtml.com/example.html
176•prafandy•9h ago•31 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.