Browse Source

addition reading exponent out of double numbers

master
Dennis Sperzel 11 months ago
parent
commit
8043dce84f
  1. 11
      src/addition.c
  2. 2
      src/addition.h

11
src/addition.c

@ -111,11 +111,22 @@ float addition_float(float number1, float number2) {
return num3.number.floating; return num3.number.floating;
} }
// reading sign out of an integer (double number)
unsigned long long sign_double(unsigned long long a) { unsigned long long sign_double(unsigned long long a) {
if (a & 0x8000000000000000) return 1; if (a & 0x8000000000000000) return 1;
else return 0; else return 0;
} }
// reading precision out of an integer (double number)
unsigned long long precision_double(unsigned long long a) { unsigned long long precision_double(unsigned long long a) {
return a & 0x000fffffffffffff; return a & 0x000fffffffffffff;
} }
// reading exponent out of an integer (double number)
unsigned long long exponent_double(unsigned long long number) {
unsigned long long exponent = 0x7ff0000000000000;
return (number & exponent) >> 52;
}

2
src/addition.h

@ -27,4 +27,6 @@ unsigned long long sign_double(unsigned long long a);
unsigned long long precision_double(unsigned long long a); unsigned long long precision_double(unsigned long long a);
unsigned long long exponent_double(unsigned long long number);
#endif // ADDITION_H #endif // ADDITION_H
Loading…
Cancel
Save