Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- AMD Community
- Communities
- Developers
- Newcomers Start Here
- Binary arithmetic for decimal numbers

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

03-20-2022
07:52 PM

Binary arithmetic for decimal numbers

All this is achieved using the algorithm for the correct rounding of binary floating point numbers, presented at

1 Reply

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

03-27-2022
05:39 PM

1.23456789012345E21-1.23456789012341E21

You will get the result 39845888. Calculate this difference using any programming language that supports the IEEE754 standard and you will get the same answer. Although in decimal arithmetic you will get the exact answer - 4.0E7.

In the arithmetic of binary equivalents of decimal numbers, which I propose, the result will be exactly the same as in decimal arithmetic. You can check it in the online compiler and debugger for c/c++ at https://onlinegdb.com/UDRshDW3l.

Here is my code for adding/subtracting double numbers. You can enter any number in the input and get correct decimal answers.