From 8f20eaafb841cb090a1b2880118cfa771498b5ca Mon Sep 17 00:00:00 2001 From: Dennis Sperzel Date: Wed, 7 Feb 2024 10:13:58 +0100 Subject: [PATCH] addition reading precision out of double numbers --- src/addition.c | 5 +++++ src/addition.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/addition.c b/src/addition.c index 0b864a9..d43de60 100644 --- a/src/addition.c +++ b/src/addition.c @@ -114,4 +114,9 @@ float addition_float(float number1, float number2) { unsigned long sign_double(unsigned long a) { if (a & 0x8000000000000000 == 0x8000000000000000) return 1; else return 0; +} + +unsigned long precision_double(unsigned long a) { + a &= 0x000fffffffffffff; + return a; } \ No newline at end of file diff --git a/src/addition.h b/src/addition.h index 89a0297..c770bd8 100644 --- a/src/addition.h +++ b/src/addition.h @@ -25,4 +25,6 @@ float addition_float(float number1, float number2); unsigned long sign_double(unsigned long a); +unsigned long precision_double(unsigned long a); + #endif // ADDITION_H \ No newline at end of file