frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Docker is weird

https://codeandcake.dev/posts/2026-10-22-docker-is-weird
168•psxuaw•3h ago•73 comments

LLMs are making formal software verification feasible at a much larger scale

https://www.anthropic.com/research/formal-verification
150•johnbender•3h ago•71 comments

Quad9 (DNS Resolver) to Exit France

https://quad9.net/news/blog/au-revoir-france/
1025•farrokhi•12h ago•368 comments

OpenShell – A safe, private runtime for fleets of autonomous AI agents

https://github.com/NVIDIA/OpenShell
316•niemandhier•9h ago•163 comments

Woman faces six years in prison over Cash App account she never opened

https://www.techspot.com/news/114296-woman-spends-three-nights-jail-faces-six-years.html
534•oidar•13h ago•550 comments

Every AI model has the same "controversial" take on humans

https://www.modelcompare.ai/blog/ai-models-controversial-take-on-humans
256•rakannimer•10h ago•320 comments

Getting ready to operate GNU Taler in Germany

https://www.taler.net/en/news/2026-13.html
231•dewey•10h ago•85 comments

Run full iOS 16.5 firmware on Android Devices

https://github.com/oosexgang/hackios-xnu-kernel
341•aghuang•11h ago•129 comments

AI compute is the new oil–and needs a new market

https://www.economist.com/finance-and-economics/2026/10/22/ai-compute-is-the-new-oil-and-needs-a-...
25•ijidak•3h ago•16 comments

The Secret Life of Circuits is now in stock everywhere

https://blog.coredump.cx/p/the-secret-life-of-circuits-is-now
21•surprisetalk•2d ago•7 comments

Jailbreaking the Switch 2

https://pepsipu.com/blog/2026-10-switch2-jailbreak-ns2jb/
737•ledoge•18h ago•255 comments

Mortality Among People with Attention-Deficit/Hyperactivity Disorder

https://jamanetwork.com/journals/jamanetworkopen/fullarticle/2855472
9•gumby•2d ago•0 comments

What Is Gridifcation

https://musicalform.substack.com/p/what-is-gridifcation
411•gumby•3d ago•202 comments

Hedra is a 3D open world game I wrote from scratch while in highschool

https://github.com/maxilevi/project-hedra/tree/pre-ai
143•maxilevi•8h ago•29 comments

Jank – The native Clojure dialect with seamless C++ interop

https://jank-lang.org/
19•giancarlostoro•2h ago•1 comments

The foolishness of "natural language programming" (1978)

https://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD667.html
41•xiaoyu2006•1h ago•43 comments

eMudhra to exit global SSL/TLS certificate business

https://emudhra.com/en/press-release/emudhra-to-exit-global-ssl-tls-certificate-business
950•bo0tzz•13h ago•637 comments

Mapping the Northern Sky

https://www.maps.com/star-map-charts-stars-and-constellations-of-northern-hemisphere/
18•tmseidman•2h ago•5 comments

Xbox wants you to pay 24 to 40 cents per hour to stream games you bought

https://arstechnica.com/gaming/2026/10/xbox-wants-you-to-pay-24-to-40-cents-per-hour-to-stream-ga...
225•entryleveljobsc•15h ago•213 comments

Tell HN: I unknowingly broke the PHP RCE embargo. I am sorry.

402•petecooper•16h ago•168 comments

Railpass

https://train.samismith.com/
56•CharlesW•5h ago•17 comments

Color Names

https://names.color.pizza
21•akkartik•2d ago•2 comments

How to Design Flowers

https://www.asimov.press/p/flowers
21•surprisetalk•2d ago•2 comments

AI and the Enclosure of the Scientific Commons

https://arxiv.org/abs/2610.27251
116•jrepinc•8h ago•71 comments

Speeding up code review with `small-change`

https://lethain.com/small-changes/
28•alexmolas•3d ago•15 comments

Dungeon Generation in the Gnomish Mines of NetHack

https://www.boristhebrave.com/2026/10/18/dungeon-generation-in-the-gnomish-mines-of-nethack/
129•ibobev•3d ago•16 comments

Faster than earcut: triangulating 3.7M map polygons in 489 ms

https://globus.software/blog/2026/10/16/cutting-map-polygons/
206•molind•17h ago•38 comments

Show HN: Uberblok – an interactive museum of ZFS internals

https://uberblok.storagebits.workers.dev/
86•storagebits•1d ago•22 comments

A farewell to Arc browser

https://arc.net/
235•suhdonghwi•10h ago•211 comments

What’s getting pwned right now

https://pwn.watch/
350•mrkd•12h ago•161 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.