frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Show HN: Boing

https://boing.greg.technology/
251•gregsadetsky•4h ago•41 comments

Zigbook Is Plagiarizing the Zigtools Playground

https://zigtools.org/blog/zigbook-plagiarizing-playground/
170•todsacerdoti•4h ago•25 comments

Bazzite: The next generation of Linux gaming

https://bazzite.gg/
369•doener•10h ago•254 comments

All it takes is for one to work out

https://alearningaday.blog/2025/11/28/all-it-takes-is-for-one-to-work-out-2/
492•herbertl•12h ago•239 comments

Meshtastic

https://meshtastic.org/
125•debo_•7h ago•25 comments

Landlock-Ing Linux

https://blog.prizrak.me/post/landlock/
175•razighter777•11h ago•62 comments

The HTTP Query Method

https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-14.html
143•Ivoah•3d ago•61 comments

Jiga (YC W21) Is Hiring Product Designer

https://www.ycombinator.com/companies/jiga/jobs/Cco7vyK-product-designer-remote-europe
1•grmmph•1h ago

Learning Feynman's Trick for Integrals

https://zackyzz.github.io/feynman.html
179•Zen1th•12h ago•20 comments

Dynamic Skillset Reference Architecture

https://chatbotkit.com/examples/dynamic-skillset-reference-architecture
5•_pdp_•3d ago•1 comments

Americans no longer see four-year college degrees as worth the cost

https://www.nbcnews.com/politics/politics-news/poll-dramatic-shift-americans-no-longer-see-four-y...
238•jnord•9h ago•332 comments

A new Little Prince museum has opened its doors in Switzerland

https://www.lepetitprince.com/en/events-around-the-world/a-new-little-prince-museum-has-opened-it...
53•gnabgib•7h ago•23 comments

Blender facial animation tool. What else should it do?

https://github.com/shun126/livelinkface_arkit_receiver/wiki
77•happy-game-dev•2d ago•13 comments

Datacenters in space aren't going to work

https://taranis.ie/datacenters-in-space-are-a-terrible-horrible-no-good-idea/
267•mindracer•18h ago•211 comments

Scala

https://www.huygens-fokker.org/scala/
54•onestay42•8h ago•11 comments

Show HN: Nano PDF – A CLI Tool to Edit PDFs with Gemini's Nano Banana

https://github.com/gavrielc/Nano-PDF
124•GavCo•11h ago•28 comments

Be Like Clippy

https://be-clippy.com/
275•Aloha•12h ago•173 comments

Matrix Core Programming on AMD CDNA Architecture

https://rocm.blogs.amd.com/software-tools-optimization/matrix-cores-cdna/README.html
19•salykova•4d ago•2 comments

Leak confirms OpenAI is preparing ads on ChatGPT for public roll out

https://www.bleepingcomputer.com/news/artificial-intelligence/leak-confirms-openai-is-preparing-a...
642•fleahunter•21h ago•579 comments

An update on the Farphone's battery

https://far.computer/battery-update/
83•louismerlin•1d ago•53 comments

Rare X-ray images of a 4.5-ton satellite that returned intact from space

https://www.empa.ch/web/s604/eureca-satellit-mit-roentgenmethoden-untersucht
82•giuliomagnifico•3d ago•12 comments

Anthony Bourdain's Lost Li.st's

https://bourdain.greg.technology/
270•gregsadetsky•4d ago•82 comments

Testing shows automotive glassbreakers can't break modern automotive glass

https://www.core77.com/posts/138925/Testing-Shows-Automotive-Glassbreakers-Cant-Break-Modern-Auto...
118•surprisetalk•16h ago•126 comments

Hardening the C++ Standard Library at scale

https://queue.acm.org/detail.cfm?id=3773097
144•ndesaulniers•1w ago•70 comments

Show HN: Network Monitor – a GUI to spot anomalous connections on your Linux

117•grigio•5d ago•45 comments

Our Phosphorescent World

https://aeon.co/essays/the-cycling-of-phosphorus-is-the-basis-for-all-life-on-earth
9•the-mitr•5d ago•0 comments

Stopping bad guys from using my open source project (feedback wanted)

https://evanhahn.com/stopping-bad-guys-from-using-my-open-source-project/
80•emschwartz•7h ago•123 comments

A new myth appeared during the presidential campaign of Andrew Jackson

https://www.historynewsnetwork.org/article/self-made
36•Petiver•4d ago•69 comments

Zero knowlege proof of compositeness

https://www.johndcook.com/blog/2025/11/29/zkp-composite/
102•ColinWright•14h ago•32 comments

Student perceptions of AI coding assistants in learning

https://arxiv.org/abs/2507.22900
83•victorbuilds•14h ago•107 comments
Open in hackernews

Comparing floating-point numbers (2012)

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

Comments

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