frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Safe-math-rs – write normal math expressions safely(overflow-checked, no panics)

https://github.com/GotenJBZ/safe-math-rs
1•gotenjbz•6h ago

Comments

gotenjbz•6h ago
Hi all, I just released safe-math-rs, a Rust library that lets you write normal arithmetic expressions (a + b * c / d) while automatically checking all operations for overflow and underflow.

It uses a simple procedural macro: #[safe_math], which rewrites standard math into its checked_* equivalents behind the scenes.

Example: use safe_math_rs::safe_math;

#[safe_math] fn calculate(a: u8, b: u8) -> Result<u8, ()> { Ok((a + b * 2) / 3) }

assert_eq!(calculate(9, 3), Ok(5)); assert!(calculate(255, 1).is_err()); // overflow Under the hood: Your code:

#[safe_math] fn add(a: u8, b: u8) -> Result<u8, ()> { Ok(a + b) } Becomes:

fn add(a: u8, b: u8) -> Result<u8, ()> { Ok(self.checked_add(rhs).ok_or(())?) } Looking for: Feedback on the macro's usability, syntax, and integration into real-world code

Bug reports

GitHub: https://github.com/GotenJBZ/safe-math-rs

So long, and thanks for all the fish

Airbnb faces multi-jurisdictional legal action

https://www.business-humanrights.org/en/latest-news/airbnb-faces-multi-jurisdictional-legal-actions-over-alleged-profiting-from-rentals-in-illegal-israeli-settlements/
1•01-_-•54s ago•0 comments

'It is a better programmer than me': The reality of being laid off due to AI

https://www.independent.co.uk/news/world/americas/ai-job-layoffs-tech-unemployment-b2769796.html
2•roboboffin•5m ago•0 comments

Cyberattack on Washington Post Strikes Journalists' Email Accounts

https://www.wsj.com/tech/cybersecurity/cyberattack-on-washington-post-compromises-email-accounts-of-journalists-70bf1300
2•perihelions•8m ago•1 comments

Spyware and state abuse: The case for an EU-wide ban

https://edri.org/our-work/spyware-and-state-abuse-the-case-for-an-eu-wide-ban-position-paper/
2•robtherobber•11m ago•0 comments

New Go-playing trick defeats world-class Go AI–but loses to human amateurs(2022)

https://arstechnica.com/information-technology/2022/11/new-go-playing-trick-defeats-world-class-go-ai-but-loses-to-human-amateurs/
1•mpweiher•12m ago•0 comments

A complete formalization of Fermat's Last Theorem for regular primes in Lean

https://arxiv.org/abs/2410.01466
2•ColinWright•15m ago•0 comments

Understanding Memory Management, Part 6: Basic Garbage Collection

https://educatedguesswork.org/posts/memory-management-6/
2•ibobev•19m ago•0 comments

Noam Chomsky: The False Promise of ChatGPT

https://www.nytimes.com/2023/03/08/opinion/noam-chomsky-chatgpt-ai.html
5•simonebrunozzi•21m ago•0 comments

Ask HN: I found a bug that lets me use YC partner perk free.what should I do?

1•bugtesting-one•25m ago•0 comments

An Architectural Approach to Decentralization

https://www.infocentral.org/
1•Bogdanp•27m ago•0 comments

SelfDB: The last Back end as a service you will pay for

https://selfdb.io
1•selfdb_io•29m ago•1 comments

Can shoes be made in the US without cheap labour?

https://www.bbc.com/news/articles/cr4zvezn5nlo
2•dabinat•30m ago•0 comments

Dart and WebAssembly with JavaScript Interop

https://nick-fisher.com/articles/dart-javascript-interop-web-assembly/
1•nmfisher•33m ago•0 comments

How I Passed the AWS Certified Security – Specialty (SCS-C02) Exam in 2025

https://thehiddenport.dev/posts/aws-scs-c02-exam-experience/
1•ejher•34m ago•0 comments

Show HN: Mockstar – AI mock interviews and feedback for jobseekers

https://mockstar.co/
1•mattdotam•34m ago•0 comments

Jio and Jio-Fiber Down in Parts of India

1•saharshpruthi•37m ago•0 comments

What is cosh(List(Bool))? Or beyond algebra: analysis of data types

http://cofault.com/aodt.html
1•fanf2•41m ago•0 comments

Google Is Scamming Users with VEO 3, While Delivering VEO 2 Instead

4•machmadera•41m ago•1 comments

The right way to make AI part of your tech strategy

https://leaddev.com/technical-direction/right-way-make-ai-part-your-tech-strategy
1•argoeris•42m ago•0 comments

SAZ Caption AI

https://reach-boost-captions-craft.lovable.app
2•sigma-male•44m ago•2 comments

Show HN: Compiler for Writing Ethereum Smart Contracts with TypeScript

2•chase-manning•46m ago•0 comments

Show HN: Better Docx Import and Export Support for Tiptap Editor

8•philipisik•47m ago•0 comments

Timdle

https://www.timdle.com/
2•kaharvi•49m ago•0 comments

Choosing where to spend my team's effort

https://frederickvanbrabant.com/blog/2025-06-13-choosing-where-to-spend-my-teams-effort/
3•TheEdonian•51m ago•0 comments

A Systematic Review and New Analyses of the Gender-Equality Paradox

https://journals.sagepub.com/doi/10.1177/17456916231202685
2•mpweiher•51m ago•0 comments

Jordan's black refugees

https://weeklygazette.substack.com/p/jordans-black-refugees
2•progju•55m ago•0 comments

Apple quietly makes running Linux containers easier on Macs

https://www.zdnet.com/article/apple-quietly-makes-running-linux-containers-easier-on-macs/
2•abricq•56m ago•0 comments

Best Antidetect Browser Setups for Social Media Marketers

1•RainbowJ•57m ago•0 comments

The Gnarly Man

https://en.wikipedia.org/wiki/The_Gnarly_Man
1•nobody9999•58m ago•0 comments

Show HN: Shame Meter

https://twitter.com/the2ndfloorguy/status/1929074655517610073
3•madinmo•1h ago•0 comments