frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Ask HN: How is it possible to get -0.0 in a sum?

8•gus_massa•10h ago
I'm looking for corner cases where he result is -0.0. As far as I know, the only way to get -0.0 in a sum is

  (-0.0) + (-0.0)
Does someone know any other case in IEEE 754?

Bonus question: What happens in subtractions? I only know

  (-0.0) - (+0.0)
Is there any other case?

Comments

sparkie•6h ago
It depends on the FP rounding mode. If rounding mode is FE_TOWARDZERO/FE_UPWARD/FE_TONEAREST then the case you gave is the only one I'm aware of. If rounding mode is FE_DOWNWARD (towards negative infinity) then other calculations that result in a zero will give a -0.0.

Here's an example of -1.0f + 1.0f resulting in -0.0: https://godbolt.org/z/5qvqsdh9P

kazinator•4h ago
What happens if we take the smallest (as in closest to zero) negative subnormal and add it to itself?
gus_massa•3h ago
Copying the example by sparkie, something like this? https://godbolt.org/z/xhdnb9ax3 I get +0.0 if I comment the round to negative option.

Ask HN: Who wants to be hired? (August 2025)

109•whoishiring•1d ago•242 comments

Ask HN: Who is hiring? (August 2025)

215•whoishiring•1d ago•263 comments

Ask HN: Does your company back up its GitHub/Gitlab source code?

2•wewewedxfgdf•1h ago•2 comments

Ask HN: Is fast.ai's "Deep Learning for Coders" still relevant in 2025?

4•hedgehog0•4h ago•0 comments

I launched 17 side projects. Result? I'm rich in expired domains

358•cesargstn•3d ago•252 comments

Ask HN: Will AI push more of us into freelancing?

12•gashmol•13h ago•12 comments

Ask HN: How is it possible to get -0.0 in a sum?

8•gus_massa•10h ago•3 comments

AI Teammates for for Revenue Teams

2•davismartens•8h ago•0 comments

I underestimated how lonely building solo can be

8•paulwilsonn•14h ago•5 comments

Ask HN: Have you ever regretted open-sourcing something?

6•paulwilsonn•12h ago•9 comments

Ask HN: Is true democracy possible in online tech communities?

12•ff12wq111•21h ago•37 comments

Nova: A New Web Framework for Erlang

67•taure•2d ago•26 comments

Ask HN: How do you avoid job hunting burnout?

16•b8•1d ago•10 comments

Ask HN: Who Is Looking for a Cofounder?

24•dontoni•1d ago•11 comments

Claude Code weekly rate limits

603•thebestmoshe•5d ago•703 comments

Ask HN: What are you working on? (July 2025)

258•david927•6d ago•847 comments

Ask HN: Which software companies hire people in Africa for remote work?

6•DanieleProcida•1d ago•3 comments

Ask HN: Is "messaging systems specialist" a real job title or niche?

6•pella_may•1d ago•2 comments

Tell HN: Gemini CLI is buggy; use at your own risk

3•prmph•1d ago•0 comments

Ask HN: Best AI Automation Platform

3•franze•1d ago•1 comments

Ask HN: AI Chat Agent vs. Traditional Personal Website?

4•JaiRathore•1d ago•6 comments

Ask HN: Anyone know how to reach Cloudflare support?

7•OhMeadhbh•1d ago•6 comments

Tell HN: Add "NSFW" words in your Google query to avoid AI summary

22•behnamoh•4d ago•20 comments

Ask HN: Startups, 0 Stability – Is It Time to Move on from Tech?

8•OulaX•1d ago•7 comments

Ask HN: How will the OSA affect small Mastodon instances?

29•Digit-Al•4d ago•15 comments

Has AI coding gone too far? I feel like I'm losing control of my own projects

14•Shaun0•2d ago•11 comments

Comparison Between Sync Engines

2•belchiorb•1d ago•2 comments

Warp.dev Terminal – Overpriced, Buggy, and AI-Sabotaged My Code

56•MistermanX•6d ago•39 comments

Ask HN: Are developers sad about AI writing more of their code?

14•JFerreol_J•2d ago•23 comments

Has any YC founder ever gone to jail for startup-related crimes?

8•TeslaK20•1d ago•3 comments