frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

After Ruining a Treasured Water Resource, Iran Is Drying Up

https://e360.yale.edu/features/iran-water-drought-dams-qanats
154•YaleE360•3h ago•100 comments

Slowness Is a Virtue

https://blog.jakobschwichtenberg.com/p/slowness-is-a-virtue
69•jakobgreenfeld•2h ago•30 comments

Most Parked Domains Now Serving Malicious Content

https://krebsonsecurity.com/2025/12/most-parked-domains-now-serving-malicious-content/
13•bookofjoe•36m ago•1 comments

GitHub Actions for Self-Hosted Runners Price Increase Postponed

https://pricetimeline.com/news/189
114•taubek•5h ago•67 comments

It's all about momentum

https://combo.cc/posts/its-all-about-momentum-innit/
46•sph•3h ago•9 comments

RCE via ND6 Router Advertisements in FreeBSD

https://www.freebsd.org/security/advisories/FreeBSD-SA-25:12.rtsold.asc
63•weeha•5h ago•36 comments

Classical statues were not painted horribly

https://worksinprogress.co/issue/were-classical-statues-painted-horribly/
5•bensouthwood•58m ago•0 comments

Gemini 3 Flash: Frontier intelligence built for speed

https://blog.google/products/gemini/gemini-3-flash/
1022•meetpateltech•20h ago•537 comments

Hightouch (YC S19) Is Hiring

https://hightouch.com/careers
1•joshwget•1h ago

Egyptian Hieroglyphs: Lesson 1

https://www.egyptianhieroglyphs.net/egyptian-hieroglyphs/lesson-1/
89•jameslk•7h ago•20 comments

What is an elliptic curve? (2019)

https://www.johndcook.com/blog/2019/02/21/what-is-an-elliptic-curve/
91•tzury•6h ago•9 comments

A school locked down after AI flagged a gun. It was a clarinet

https://www.washingtonpost.com/nation/2025/12/17/ai-gun-school-detection/
41•reaperducer•1h ago•35 comments

Online Textbook for Braid groups and knots and tangles

https://matthematics.com/redoak/redoak.html
21•marysminefnuf•3h ago•1 comments

Coursera to combine with Udemy

https://investor.coursera.com/news/news-details/2025/Coursera-to-Combine-with-Udemy-to-Empower-th...
534•throwaway019254•1d ago•324 comments

I got hacked: My Hetzner server started mining Monero

https://blog.jakesaunders.dev/my-server-started-mining-monero-this-morning/
475•jakelsaunders94•16h ago•302 comments

How getting richer made teenagers less free

https://www.theargumentmag.com/p/how-getting-richer-made-teenagers
136•NavinF•3h ago•136 comments

America's Dirtiest Carbon Polluters, Mapped to Ridiculous Precision

https://gizmodo.com/americas-dirtiest-carbon-polluters-mapped-to-ridiculous-precision-2000700924
42•ourmandave•2h ago•14 comments

Working quickly is more important than it seems (2015)

https://jsomers.net/blog/speed-matters
196•bschne•3d ago•97 comments

From profiling to kernel patch: the journey to an eBPF performance fix

https://rovarma.com/articles/from-profiling-to-kernel-patch-the-journey-to-an-ebpf-performance-fix/
4•todsacerdoti•4d ago•0 comments

Fluent: A Localization System for Natural-Sounding Translations

https://projectfluent.org/
7•stefankuehnel•4d ago•2 comments

Breaking Paragraphs into Lines [pdf] (1981)

https://gwern.net/doc/design/typography/tex/1981-knuth.pdf
15•Smaug123•6d ago•4 comments

Building a High-Performance OpenAPI Parser in Go

https://www.speakeasy.com/blog/building-speakeasy-openapi-go-library
20•subomi•3d ago•6 comments

Ask HN: Those making $500/month on side projects in 2025 – Show and tell

301•cvbox•11h ago•289 comments

Don MacKinnon: Why Simplicity Beats Cleverness in Software Design [audio]

https://maintainable.fm/episodes/don-mackinnon-why-simplicity-beats-cleverness-in-software-design
54•mooreds•2d ago•21 comments

AWS CEO says replacing junior devs with AI is 'one of the dumbest ideas'

https://www.finalroundai.com/blog/aws-ceo-ai-cannot-replace-junior-developers
969•birdculture•20h ago•491 comments

Gut bacteria from amphibians and reptiles achieve tumor elimination in mice

https://www.jaist.ac.jp/english/whatsnew/press/2025/12/17-1.html
437•Xunxi•14h ago•109 comments

Creating apps like Signal could be 'hostile activity' claims UK watchdog

https://www.techradar.com/vpn/vpn-privacy-security/creating-apps-like-signal-or-whatsapp-could-be...
80•donohoe•2h ago•56 comments

Judge hints Vizio TV buyers may have rights to source code licensed under GPL

https://www.theregister.com/2025/12/05/vizio_gpl_source_code_ruling/
122•pabs3•8h ago•15 comments

A Safer Container Ecosystem with Docker: Free Docker Hardened Images

https://www.docker.com/blog/docker-hardened-images-for-every-developer/
333•anttiharju•20h ago•77 comments

OBS Studio Gets a New Renderer

https://obsproject.com/blog/obs-studio-gets-a-new-renderer
275•aizk•16h ago•59 comments
Open in hackernews

Comparing floating-point numbers (2012)

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

Comments

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