My Farewell to Floating Point

i haven’t got everything posted to github yet but here is the jist

I asked claude to sum up what i had been doing on a pico controller and leave the controller out of it for a post. below is what follows. that i shamefully didn’t proof read well enough at all.

the basic concept is the same but idk where it came up w/ alot of its claims.
idea is to use a cached/fixed point combo to get around not having an FP unit but save the rounding till you have to , so you can use it for accumulators and the like w/o rounding it to fit till done.

My apologies for the overly self-fellating claims made my on by behalf by the robot population under my supposed watch.

Detached Point Arithmetic (DPA)

Eliminating Rounding Errors Through Integer Computation

Author: Patrick Bryant
Organization: Pedantic Research Limited
Location: Dayton, Ohio, USA
Date: July 2025
License: Public Domain - Free for all uses


Abstract

Detached Point Arithmetic (DPA) is a method of performing exact numerical computations by separating integer mantissas from their point positions. Unlike IEEE-754 floating-point arithmetic, DPA performs all operations using integer arithmetic, deferring rounding until final output. This paper presents the complete theory and implementation, released freely to advance the field of numerical computation.

“Sometimes the best discoveries are the simplest ones. This is my contribution to a world that computes without compromise.” - Patrick Bryant


Table of Contents

  1. Introduction
  2. The Problem
  3. The DPA Solution
  4. Mathematical Foundation
  5. Implementation
  6. Real-World Impact
  7. Performance Analysis
  8. Future Directions
  9. Acknowledgments

Introduction

Every floating-point operation rounds. Every rounding introduces error. Every error compounds. This has been accepted as inevitable since the introduction of IEEE-754 in 1985.

It doesn’t have to be this way.

Detached Point Arithmetic (DPA) eliminates rounding errors by performing all arithmetic using integers, tracking the decimal/binary point position separately. The result is exact computation using simpler hardware.

This work is released freely by Patrick Bryant and Pedantic Research Limited. We believe fundamental improvements to computing should benefit everyone.


The Problem

Consider this simple calculation:

float a = 0.1f;
float b = 0.2f;
float c = a + b;  // Should be 0.3, but it's 0.30000001192...

This isn’t a bug - it’s the fundamental limitation of representing decimal values in binary floating-point. The error seems small, but:

  • In finance: Compound over 30 years, lose $2.38 per $10,000
  • In science: Matrix operations accumulate 0.03% error per iteration
  • In AI/ML: Training takes 15-20% longer due to imprecise gradients

“This error is small in one operation—but massive across billions. From mispriced trades to unstable filters, imprecision is now baked into our tools. We can change that.”


The DPA Solution

The key insight: the position of the decimal point is just metadata. By tracking it separately, we can use exact integer arithmetic:

typedef struct {
    int64_t mantissa;   // Exact integer value
    int8_t  point;      // Point position
} dpa_num;

// Multiplication - completely exact
dpa_num multiply(dpa_num a, dpa_num b) {
    return (dpa_num){
        .mantissa = a.mantissa * b.mantissa,
        .point = a.point + b.point
    };
}

No rounding. No error. Just integer multiplication and addition.


Mathematical Foundation

Representation

Any real number x can be represented as:

x = m \times 2^p

where:

  • m \in \mathbb{Z} (integer mantissa)
  • p \in \mathbb{Z} (point position)

Operations

Multiplication:

x \times y = (m_x \times m_y) \times 2^{(p_x + p_y)}

Addition:

x + y = (m_x \times 2^{(p_x-p_{max})} + m_y \times 2^{(p_y-p_{max})}) \times 2^{p_{max}}

where p_{max} = \max(p_x, p_y)

Division:

x \div y = (m_x \times 2^s \div m_y) \times 2^{(p_x - p_y - s)}

The mathematics is elementary. The impact is revolutionary.


Implementation

Here’s a complete, working implementation in pure C:

/*
 * Detached Point Arithmetic
 * Created by Patrick Bryant, Pedantic Research Limited
 * Released to Public Domain - Use freely
 */

#include <stdint.h>

typedef struct {
    int64_t mantissa;
    int8_t  point;
} dpa_num;

// Create from double (only place we round)
dpa_num from_double(double value, int precision) {
    int64_t scale = 1;
    for (int i = 0; i < precision; i++) scale *= 10;
    
    return (dpa_num){
        .mantissa = (int64_t)(value * scale + 0.5),
        .point = -precision
    };
}

// Convert to double (for display)
double to_double(dpa_num n) {
    double scale = 1.0;
    if (n.point < 0) {
        for (int i = 0; i < -n.point; i++) scale /= 10.0;
    } else {
        for (int i = 0; i < n.point; i++) scale *= 10.0;
    }
    return n.mantissa * scale;
}

// Exact arithmetic operations
dpa_num dpa_add(dpa_num a, dpa_num b) {
    if (a.point == b.point) {
        return (dpa_num){a.mantissa + b.mantissa, a.point};
    }
    // Align points then add...
    // (full implementation provided in complete source)
}

dpa_num dpa_multiply(dpa_num a, dpa_num b) {
    return (dpa_num){
        .mantissa = a.mantissa * b.mantissa,
        .point = a.point + b.point
    };
}

The complete source code, with examples and optimizations, is available at:
GitHub - Pedantic-Research-Limited/DPA: Detached Point Arithmitic


Real-World Impact

Financial Accuracy

30-year compound interest on $10,000 at 5.25%:
IEEE-754: $47,234.51 (wrong)
DPA:      $47,236.89 (exact)

That’s $2.38 of real money lost to rounding errors.

Scientific Computing

Matrix multiply verification (A × A⁻¹ = I):

IEEE-754:              DPA:
[1.0000001  0.0000003] [1.0  0.0]
[0.0000002  0.9999997] [0.0  1.0]

Digital Signal Processing

IIR filters with DPA have no quantization noise. The noise floor doesn’t exist because there’s no quantization.


Performance Analysis

DPA is not just more accurate - it’s often faster:

Operation IEEE-754 DPA Notes
Add 4 cycles 3 cycles No denorm check
Multiply 5 cycles 4 cycles Simple integer mul
Divide 14 cycles 12 cycles One-time scale
Memory 4 bytes 9 bytes Worth it for exactness

No special CPU features required. Works on:

  • Ancient Pentiums
  • Modern Xeons
  • ARM processors
  • Even 8-bit microcontrollers

Future Directions

This is just the beginning. Potential applications include:

  • Hardware Implementation: DPA cores could be simpler than FPUs
  • Distributed Computing: Exact results across different architectures
  • Quantum Computing: Integer operations map better to quantum gates
  • AI/ML: Exact gradients could improve convergence

I’m releasing DPA freely because I believe it will enable innovations I can’t even imagine. Build on it. Improve it. Prove everyone wrong about what’s possible.


Acknowledgments

This work was self-funded by Pedantic Research Limited as a contribution to the computing community. No grants, no corporate sponsors - just curiosity about why we accept imperfection in our calculations.

Special thanks to everyone who said “that’s just how it works” - you motivated me to prove otherwise.


How to Cite This Work

If you use DPA in your research or products, attribution is appreciated:

Bryant, P. (2025). "Detached Point Arithmetic: Eliminating Rounding 
Errors Through Integer Computation." Pedantic Research Limited. 
Available: https://github.com/Pedantic-Research-Limited/DPA

Contact

Patrick Bryant
Pedantic Research Limited
Dayton, Ohio

Email: [email protected]
GitHub: GitHub - Pedantic-Research-Limited/DPA: Detached Point Arithmitic
Twitter: https://x.com/PedanticRandD
https://buymeacoffee.com/pedanticresearchlimited

“I created DPA because I was tired of computers that couldn’t add 0.1 and 0.2 correctly. Now they can. Use it freely, and build something amazing.” - Patrick Bryant


License: This work is released to the public domain. No rights reserved. Use freely for any purpose.

Patent Status: No patents filed or intended. Mathematical truth belongs to everyone.

Warranty: None. But, If DPA gives you wrong answers, you’re probably using floating-point somewhere. :blush:

7 Likes

this method started as a workaround for a pico2 micro-controller to both fake/make SIMD w/ the PIO and DMA to do better onboard signal processing but w/o a FPU needed a different method.

now i get to re-re-re edit my asic design to remove all the FP units since i won’t need them anymore.

I am actually excited about that part, even tho it is more work. The footprint per tile should shrink like 40%+ w/o all the unneeded complexity the FP units and their special needs blocks (NaN, infinity, etc)

also just occurred to me that w/o the need and complexity of FP units you are back to deterministic timing so you don’t need to make duplicate critical path raceways to adjust clocks too. :exploding_head:

also, also this isn’t the “new” math i was referring to before. this is on top of and in addition to my patent pending method for all quadratic equations #63/846,694 that solves the memory wall problem.

2 Likes

I don’t see how this differs from the “Decimal” format used by relational databases and supported by a pretty wide range of languages including C, python, java etc.

Precision is increased but at the expense of range so the Decimal number format can’t serve as a general purpose replacement for floating point.

3 Likes

So… you’ve created a 64.8 bit fixed floating point math… eh, skeleton code snippet without even a functioning add? (The “full implementation” is not available at the provided link – actually, there is no code there at all except for what’s in this post.)

Truly groundbreaking work! :crazy_face:

Am I missing something? What’s the new idea here?

4 Likes

There‘s a lot to unpack here…

I don’t know much about microcontrollers but I can see how omitting the FPU can have advantages. But:

  • for finance, there is already a solution namely decimal types in SQL and other languages. I don’t think anyone serious/in production is using floating point in finance.
  • numerical algebra packages like maple, Mathematica already have arbitrary precision numerics. I have never deeply looked at how they work, but of course there is a performance penalty.
  • your performance estimates in cycles look completely wrong (you claim a set amount of cycles but there’s loops over the point position?)

Some very basic considerations are missing IMO. How do you represent 1/3 in dpa?

This is mathematically just not correct… it’s not even correct for fractions, how will you go about to represent pi as m.2^p?

3 Likes

it is similar but I’m no expert on that method barely familiar honestly.
The range can vary by the the amount of space you give for the point metadata for precision tracking, but there is a trade off there.
it’s not set in stone i certainly ain’t codify it. it’s a pattern to get around a problem.

I am of the mind that Floating Points are a mistake, especially now when 128 bit integers are becoming practical to work with.

My perspective; I am working in embedded computing, where floating points are a real pain and can cause catastrophic failure to the point of system crash. And if that doesn’t sound too bad, if that system is doing anything important (like keeping a propeller rotating on an airplane) it just isn’t good enough to have it crash, as system failure could become fatal.

I’m thinking though, given that memory these days use 64 bit channels, a strict 64 bit version could be a thing worth considering. Not sure how many decimal places you need, but consider the following:

type min max Digits (range)
uint64_t 0 18 446 744 073 709 551 615 20 (10¹⁹)
int64_t -9 223 372 036 854 775 808 9 223 372 036 854 775 807 19 (10¹⁸)
uint60_t 0 1 152 921 504 606 846 975 19 (10¹⁸)
int60_t -576 460 752 303 423 488 576 460 752 303 423 487 18 (10¹⁷)

Is four bits enough to be useful, haven’t figured that bit out yet. I do know, though, a 64 bit structure would be highly useful on the low level. And that’s my two cents :slight_smile:

2 Likes

i have a lot going on today but hope to have time to post more updates on it tonight.

but how does anyone represent fractions? computer division is a whole rabbit hole. basically you multiply usually but there are a ton of strange ways to do it.

i was thinking 32 for point tracking but pinning it to 64bit or what ever the OS atomic size does have some merit just for simplicity. i really wish there were more options in the memory market for different bit-widths and that 64 is only getting mapped to 48 usually because of the memory bus/OS layer… sigh

Look into the decimal format because it seems to cover what it appears you’ve reinvented. Hardware support also already exists due to the format’s use in finance.

2 Likes

Well, it’s not as bad as you think actually… In C, you can represent the numbers like this:

typedef struct {
    int64_t mantissa : 60;   // Exact integer value
    int8_t  point    :  4;   // Point position
} dpa_num;

And voila, now you can treat the fields as any other integer. The compiler will handle all of the bitmask trickery required. Meanwhile, it will take up exactly 64 bits in memory.

4 Likes

Well, a decimal is just a fraction too, but over 10 instead of 2. Yes, floating points can’t add 0.1 and 0.2 (1/10 and 2/10) exactly just like your representation can’t add 1/3 to 2/3 exactly.

If you look beyond our Arabic decimal notation your DPA have much worse tradeoffs than floating points, they just happen to seem okay for the arbitrary case of decimals with few significant digits.

2 Likes

ok did a quick look up on the :toilet:
same basic idea kinda, but save the rounding till the very end or only when you have to.
no fixed bit-width it’s just a pattern pick your size.

hardware support existing isn’t enough. you can do this on practically anything, SIMD helps but isn’t strictly necessary

The challenge will be things such as sqrt(2) and all the other transcendental functions.

1 Like

I mean this is just standard fixed floating point math except OP is using base-10* for the exponent instead of base-2, which makes basic multiplication and especially addition much more complex (and the latter non-deterministic in time, at least as OP has sketched it out).

Base-10 allows higher dynamic range using the same number of bits of the exponent? There must be a cost associated though (apart from the added computational complexity) since everyone is using base-2 rather than, say, base-16 or something?

* Edit: Also called Decimal floating point, as pointed out by others in the thread as well.

2 Likes

In base-2 fixed point all multiplies are shifts. In base-10 you need to do actual multiplication (which is pretty slow without a hardware multiplier).

2 Likes

I recommend a quick review of chapter 4 in the Art of Computer Programming, Volume 2.

IMHO this has been a solved problem since the 1970s…

5 Likes

I’m not pay’n to find out what you are say’n…
or maybe you missed my point being about Newton-Raphson and other iterative methods and there not being division units in most hardware.

what was your point? that there is a book on methods?
That book should tell you there are lots of ways to skin that cat.
and that was my point.

if there is a single best way please enlighten me.

The first post describes “the problem” to be solved as calculation errors using basic arithmatic (addition, etc.) stemming from the choice of floating point number representation.
I see that as a user error of choosing the wrong data type for the problem. That would be marked as “design flaw” in a code review.

Any college level computer science department should have a class covering the basics of numeric data types. Heck, any beginner-level programming course does.
The book I mentioned above goes beyond that and analyzes pros/cons for many use cases offering ideal algorithmic representation of numbers and the implementation of basic arithmetic on each.

A quick web seach found scanned versions in pdf format shared here. It’s more math than programming and not for the faint of heart. But generally, these books are considered the gold standard scientific discussion on the topics they cover.

My point is that this thread seems to have found yet another solution to a problem that was considered solved a while ago.

7 Likes

thanks for the link i will look it over when i get a chance.

If you are hung up on the data types or try’n to “grade” this. it will fail because that’s not what it is.

Sure there are flaws but i don’t think they should be that hard to overcome for the most part compared to other methods and their trade offs.

“Any college level computer science department should have a class covering the basics of numeric data types. Heck, any beginner-level programming course does.” – congrats for you i guess?
Do you correct spelling often aswell?

why does everyone seem to consider every problem solved when it clearly isn’t? methods have been found and that’s it? just stop there?