frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

GenCAD

https://gencad.github.io/
36•dagenix•2h ago•6 comments

Prolog Coding Horror

https://www.metalevel.at/prolog/horror
45•RohanAdwankar•2h ago•13 comments

ThinkPad: From IBM's Bento Box to Lenovo's AI Workstations

https://www.jdhodges.com/blog/thinkpad-history/
24•zdw•2h ago•6 comments

Fabricked: Misconfiguring Infinity Fabric to Break AMD SEV-SNP

https://xca-attacks.github.io/fabricked/
14•negura•1h ago•1 comments

I turned a $80 RK3562 Android tablet into a Debian Linux workstation

https://github.com/tech4bot/rk3562deb
223•tech4bot•10h ago•114 comments

Two EA-18 fighter jets collide at Mountain Home airshow, pilots ejected safely

https://idahonews.com/news/local/two-f-18-fighter-jets-have-crashed-during-an-airshow-at-mountain...
57•ChrisArchitect•2h ago•33 comments

Ask an Astronaut: 333 hours of Q&A footage with astronauts

https://askanastronaut.issinrealtime.org/
17•gaws•2d ago•0 comments

Mercurial, 20 years and counting: how are we still alive and kicking? [video]

https://fosdem.org/2026/schedule/event/AGWUVH-mercurial-aint-you-dead-yet/
149•ibobev•2d ago•128 comments

VoIP brings back old-fashioned pay phones to rural Vermont (2025)

https://spectrum.ieee.org/payphone-voip
104•bookofjoe•4h ago•24 comments

Design posters showcasing your country's electrical grid

https://github.com/open-energy-transition/grid2poster
5•lyoncy•1h ago•1 comments

Magical Realism: “Northern Exposure” 25 Years Later (2015)

https://www.rogerebert.com/streaming/magical-realism-nothern-exposure-25-years-later
59•walterbell•1d ago•24 comments

Show HN: Semble – Code search for agents that uses 98% fewer tokens than grep

https://github.com/MinishLab/semble
125•Bibabomas•8h ago•37 comments

Hindenburg’s Smoking Room

https://www.airships.net/hindenburg-smoking-room/
144•crescit_eundo•3d ago•90 comments

Jank now has its own custom IR

https://jank-lang.org/blog/2026-05-08-optimization/
14•DASD•2d ago•0 comments

CUDA Books

https://github.com/alternbits/awesome-cuda-books
116•dariubs•11h ago•23 comments

I don't think AI will make your processes go faster

https://frederickvanbrabant.com/blog/2026-05-15-i-dont-think-ai-will-make-your-processes-go-faster/
471•TheEdonian•11h ago•335 comments

Prolog Basics Explained with Pokémon

https://unplannedobsolescence.com/blog/prolog-basics-pokemon/
200•birdculture•2d ago•32 comments

New Nightmare Just Dropped: '3D' Animated Ads on Trucks in Traffic

https://www.thedrive.com/news/new-nightmare-just-dropped-3d-animated-ads-on-trucks-in-traffic
68•cf100clunk•1d ago•27 comments

High-Entropy Alloy

https://en.wikipedia.org/wiki/High-entropy_alloy
100•leonidasrup•3d ago•22 comments

Trials on veterans suggest ibogaine could provide a new treatment for PTSD

https://www.bbc.com/future/article/20260514-how-hallucinogenic-ibogaine-helps-veterans-overcome-ptsd
74•bushwart•12h ago•78 comments

The occasional ECONNRESET

https://movq.de/blog/postings/2026-05-05/1/POSTING-en.html
86•zdw•6h ago•19 comments

Schanuel's Conjecture and the Semantics of Triton's FPSan

https://cp4space.hatsya.com/2026/05/03/schanuels-conjecture-and-the-semantics-of-fpsan/
18•c1ccccc1•1d ago•3 comments

Tesla Solar Roof is on life support as it pivot to panels

https://electrek.co/2026/05/14/tesla-solar-roof-promise-vs-reality-pivot-panels/
138•celsoazevedo•19h ago•145 comments

Native all the way, until you need text

https://justsitandgrin.im/posts/native-all-the-way-until-you-need-text/
374•dive•12h ago•250 comments

Multi-Species Canopy Latrines in Costa Rican Cloud Forests

https://onlinelibrary.wiley.com/doi/10.1002/ece3.72964
39•PaulHoule•3d ago•5 comments

AI is a technology not a product

https://daringfireball.net/2026/05/ai_is_technology_not_a_product
303•ch_sm•10h ago•120 comments

Mozilla to UK regulators: VPNs are essential privacy and security tools

https://blog.mozilla.org/netpolicy/2026/05/15/mozilla-to-uk-regulators-vpns-are-essential-privacy...
614•WithinReason•17h ago•263 comments

Apple Silicon costs more than OpenRouter

https://www.williamangel.net/blog/2026/05/17/offline-llm-energy-use.html
290•datadrivenangel•11h ago•242 comments

Colossus: The Forbin Project

https://en.wikipedia.org/wiki/Colossus:_The_Forbin_Project
210•doener•3d ago•79 comments

A nicer voltmeter clock

https://lcamtuf.substack.com/p/a-nicer-voltmeter-clock
308•surprisetalk•1d ago•41 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.