Breaking
February 20, 2025

How Hard is it to Write a Calculator App? Al Williams | usagoldmines.com

How hard can it be to write a simple four-function calculator program? After all, computers are good at math, and making a calculator isn’t exactly blazing a new trail, right? But [Chad Nauseam] will tell you that it is harder than you probably think. His post starts with a screenshot of the iOS calculator app with a mildly complex equation. The app’s answer is wrong. Android’s calculator does better on the same problem.

What follows is a bit of a history lesson and a bit of a math lesson combined. As you might realize, the inherent problem with computers and math isn’t that they aren’t good at it. Floating point numbers have a finite precision and this leads to problems, especially when you do operations that combine large and small numbers together.

Indeed, any floating point representation has a bigger infinity of numbers that it can’t represent than those that it can. But the same is true of a calculator. Think about how many digits you are willing to type in, and how many digits you want out. All you want is for each of them to be correct, and that’s a much smaller set of numbers.

Google’s developer, [Hans-J. Boehm] tackled this problem by turning to recursive real arithmetic (RRA). Here, each math function is told how accurate it needs to be, and a set of rules determines the highest required accuracy.

But every solution brings a problem. With RRA, there is no way to tell very small numbers from zero. So computing “1-1” might give you “0.000000000”, which is correct but upsetting because of all the excess precision. You could try to test if “0.00000000” was equal to “0”, and simplify the output. But testing for equality of two numbers in RRA is not guaranteed to terminate: you can tell if two numbers are unequal by going to more and more precision until you find a difference, but if the numbers happen to be equal, this procedure never ends.

The key realization for [Boehm] and his collaborators was that you could use RRA only for cases where you deal with inexact numbers. Most of the time, the Android calculator deals with rationals. However, when an operation produces a potentially irrational result, it switches to RRA for the approximation, which works because no finite representation ever gets it exactly right. The result is a system that doesn’t show excess precision, but correctly displays all of the digits that it does show.

We really like [Chad’s] step-by-step explanation. If you would rather dive into the math, you can read [Boehm’s] paper on the topic. If you ever wonder how many computer systems handle odd functions like sine and cosine, read about CORDIC. Or, avoid all of this and stick to your slide rule.

 

This articles is written by : Nermeen Nabil Khear Abdelmalak

All rights reserved to : USAGOLDMIES . www.usagoldmines.com

You can Enjoy surfing our website categories and read more content in many fields you may like .

Why USAGoldMines ?

USAGoldMines is a comprehensive website offering the latest in financial, crypto, and technical news. With specialized sections for each category, it provides readers with up-to-date market insights, investment trends, and technological advancements, making it a valuable resource for investors and enthusiasts in the fast-paced financial world.

Recent:

Two Men Plead Guilty to ‘Massive’ $577,000,000 Crypto Mining Fraud Scheme: DOJ Rhodilee Jean Dolor |...

DIY Yagi Antenna Sends LoRa Signals Farther Lewin Day | usagoldmines.com

UNIX Archaeology Turns Up 1972 “V2 Beta” Jenny List | usagoldmines.com

Microwave Motion Detector Notifies Your Smart Phone Lewin Day | usagoldmines.com

Pico Gets a Speed Bump Al Williams | usagoldmines.com

You’ve Got All Year To Print This Marble Machine Ornament For Your Christmas Tree Lewin Day | usagol...

Water Jets Will Carve Your Pumpkin Lewin Day | usagoldmines.com

Reconstructing 3D Objects With a Tiny Distance Sensor Lewin Day | usagoldmines.com

Add a Little WOPR to Your Server Rack Tom Nardi | usagoldmines.com

Pulsed Deposition Points a Different Path to DIY Semiconductors Dan Maloney | usagoldmines.com

The US Military’s Unsecured UFO Satellites and Their Use By Russia Maya Posch | usagoldmines.com

Homebrew CPU Gets a Beautiful Rotating Cube Demo Donald Papp | usagoldmines.com

FLOSS Weekly Episode 821: Rocky Linux Jonathan Bennett | usagoldmines.com

Be Careful What You Ask For: Voice Control Al Williams | usagoldmines.com

Retrotechtacular: Yamming CRT Yokes Dan Maloney | usagoldmines.com

In a World Without USB… Al Williams | usagoldmines.com

MIT Demonstrates Fully 3D Printed, Active Electronic Components Donald Papp | usagoldmines.com

Belfry OpenSCAD Library (BOSL2) Brings Useful Parts and Tools Aplenty Donald Papp | usagoldmines.com

Vacuum Forming With 3D Printed Moulds And Sheets Jenny List | usagoldmines.com

A Unique Linear Position Sensor Using Magnetostriction Dan Maloney | usagoldmines.com

$1,200,000,000 in Crypto Sent to FTX Creditors Through Kraken and Bitgo: Arkham Daily Hodl Staff | u...

Auto-Download Your Kindle Books Before February 26th Deadline Navarre Bartz | usagoldmines.com

Let There Be Light: The Engineering of Optical HDMI Heidi Ulrich | usagoldmines.com

Hackaday Europe 2025: Speakers, Lightning Talks, and More! Elliot Williams | usagoldmines.com

Series Hybrid Semi-Trucks: It Works for Locomotives So Why Not? Maya Posch | usagoldmines.com

Hack On Self: One Minute Blitz Arya Voronova | usagoldmines.com

Give Your Animal Crossing Villagers the Gift of Linux Tom Nardi | usagoldmines.com

Space Monitor Points Out Celestial Objects Tom Nardi | usagoldmines.com

Get Ready For KiCAD 9! Jenny List | usagoldmines.com

Integrated Micro Lab Keeps Track of Ammonia in the Blood Dan Maloney | usagoldmines.com

A Forgotten Consumer PC Becomes a Floating Point Powerhouse Jenny List | usagoldmines.com

Probably The Most Esoteric Commodore 64 Magazine Jenny List | usagoldmines.com

Argentinian President Javier Milei Potentially Facing Impeachment Trial From Opposition Over LIBRA L...

Measuring Local Variances in Earth’s Magnetic Field Bryan Cockfield | usagoldmines.com

Keebin’ with Kristina: the One with the Cutting Board Keyboard Kristina Panos | usagoldmines.com

Decoy Killswitch Triggers Alarm Instead Bryan Cockfield | usagoldmines.com

The “Unbreakable” Beer Glasses Of East Germany Lewin Day | usagoldmines.com

Parametric Design Process Produces Unique Speakers Bryan Cockfield | usagoldmines.com

USB Stick Hides Large Language Model Bryan Cockfield | usagoldmines.com

DaVinci’s New Threads Al Williams | usagoldmines.com

Using Antimony To Make Qubits More Stable Maya Posch | usagoldmines.com

Hackaday Links: February 16, 2025 Dan Maloney | usagoldmines.com

$80,000 Abruptly Drained From JPMorgan Chase Account – Why the Bank Says Reimbursement Is Not Happen...

Graphene Tattoos: The Future of Continuous Health Monitoring? Heidi Ulrich | usagoldmines.com

[Quinn Dunki] Makes a Screw Shortener Fit for Kings Elliot Williams | usagoldmines.com

Piano Gets an Arduino Implant Al Williams | usagoldmines.com

Scrapyard Vacuum Dehydrator Sucks the Water from Hydraulic Oil Dan Maloney | usagoldmines.com

Curious Claim of Conversion of Aluminium into Transparent Aluminium Oxide Maya Posch | usagoldmines....

Chop, Chop, Chop: Trying Out VR for Woodworking Heidi Ulrich | usagoldmines.com

You Know This Font, But You Don’t Really Know It Jenny List | usagoldmines.com

Octet of ESP32s Lets You See WiFi Like Never Before Dan Maloney | usagoldmines.com

$374,068 Drained From Bank Accounts As Bank Employee Allegedly Uses Customer Funds To Pay Husband’s ...

How To Find Where a Wire in a Cable is Broken Maya Posch | usagoldmines.com

Valentine’s Day…Hacks? Elliot Williams | usagoldmines.com

Adding USB-C (Kinda) to a PowerMac G4 Tom Nardi | usagoldmines.com

Game Bub Plays ROMs and Cartridges Bryan Cockfield | usagoldmines.com

A Guide to Making the Right Microcontroller Choice Dan Maloney | usagoldmines.com

569,012 Americans Exposed As Massive Data Breach Reveals Names, Financial Account Numbers, Credit an...

Most Energetic Cosmic Neutrino Ever Observed by KM3NeT Deep Sea Telescope Maya Posch | usagoldmines....

Wells Fargo Refuses To Return Woman’s Life Savings After Bank Account Gutted by Fraudsters – Here’s ...

Magnetic Vise Makes Positioning Your Workpiece Easier Lewin Day | usagoldmines.com

3DBenchy Sets Sail into the Public Domain Maya Posch | usagoldmines.com

Satellite Internet On 80s Hardware Bryan Cockfield | usagoldmines.com

Hackaday Podcast Episode 308: The Worst 1 Ever, Google’s Find My Opened, and SAR on a Drone Jenny Li...

Home Depot Lamp Gets a Rainbow Upgrade Lewin Day | usagoldmines.com

This Week in Security: The UK Wants Your iCloud, Libarchive Wasn’t Ready, and AWS Jonathan Bennett |...

Lathe and Laser Team Up to Make Cutting Gear Teeth Easier Dan Maloney | usagoldmines.com

3D Printed Air Raid Siren Sounds Just Like The Real Thing Lewin Day | usagoldmines.com

Understanding The Miller Effect Al Williams | usagoldmines.com

Cute Face Tells You How Bad The Air Quality Is Lewin Day | usagoldmines.com

Hacker Offered 10% Bounty After Stealing Over $9,000,000 in Ethereum (ETH) From Lending Platform Rho...

What the Well-Dressed Radio Hacker is Wearing This Season Al Williams | usagoldmines.com

The Nokia 3310 Finally Gets A USB-C Upgrade Lewin Day | usagoldmines.com

A 3D printed Camera You Can Now Download, Shutter and All Jenny List | usagoldmines.com

Why AI Usage May Degrade Human Cognition and Blunt Critical Thinking Skills Maya Posch | usagoldmine...

Tiny Typing Tutor Tuts At Your Incorrect Shift Usage Lewin Day | usagoldmines.com

NASA Taps Webb to Help Study 2032 Asteroid Threat Tom Nardi | usagoldmines.com

Budget-Minded Synthetic Aperture Radar Takes to the Skies Dan Maloney | usagoldmines.com

A Transparent BB-8 Build Using Christmas Ornaments Lewin Day | usagoldmines.com

Ponzi Scheme Mastermind Sentenced To 45,376 Years in Prison Over $131,000,000 ‘Farm Bank’ Scam Alex ...

On the Original Punched Cards Al Williams | usagoldmines.com

Automatic Pill Dispenser Is Cheap and Convenient Lewin Day | usagoldmines.com

Florida Man Ordered To Pay $7,600,000 in Restitution After Promoting Supposed ‘Gold-Backed’ Cryptocu...

DIY Microwave Crucibles Al Williams | usagoldmines.com

Will Embodied AI Make Prosthetics More Humane? Heidi Ulrich | usagoldmines.com

FLOSS Weekly Episode 820: Please Don’t add AI Clippy to Thunderbird Jonathan Bennett | usagoldmines....

PCB Design Review: M.2 SSD Splitter Arya Voronova | usagoldmines.com

Safer and More Consistent Woodworking With a Power Feeder Maya Posch | usagoldmines.com

Plastic On The Mind: Assessing the Risks From Micro- and Nanoplastics Maya Posch | usagoldmines.com

Laser Cut Acrylic Provides Movie-Style Authentication Tom Nardi | usagoldmines.com

New Documentary Details Ventilator Development Efforts During COVID Donald Papp | usagoldmines.com

It’s Always Pizza O’Clock With This AI-Powered Timepiece Dan Maloney | usagoldmines.com

Push Your Toy Train No More, With This Locomotive! Jenny List | usagoldmines.com

Google FindMy Tools, Run on an ESP32 Elliot Williams | usagoldmines.com

A Tiny Computer With a 3D Printed QWERTY Keyboard Jenny List | usagoldmines.com

A Tiny Tapeout SDR Jenny List | usagoldmines.com

Hearing What the Bats Hear Elliot Williams | usagoldmines.com

Improving Aluminium-Ion Batteries With Aluminium-Fluoride Salt Maya Posch | usagoldmines.com

The Science Behind Making Buildings Comfortably Non-Combustible Maya Posch | usagoldmines.com

Precision Reference Puts Interesting Part to Work Dan Maloney | usagoldmines.com

Leave a Reply