X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Ffloat%2Fffloat%2Felem%2Fcl_FF_div.cc;h=7f1d802ece3d3d8a5a6cb9b3f8e1e613afc61dab;hb=HEAD;hp=bc9f21f7001c5868d071a88787e846557fcca108;hpb=c486b78a1a0613f07a10816d6f6ca9e485bc8290;p=cln.git diff --git a/src/float/ffloat/elem/cl_FF_div.cc b/src/float/ffloat/elem/cl_FF_div.cc index bc9f21f..7f1d802 100644 --- a/src/float/ffloat/elem/cl_FF_div.cc +++ b/src/float/ffloat/elem/cl_FF_div.cc @@ -1,7 +1,7 @@ // binary operator / // General includes. -#include "cl_sysdep.h" +#include "base/cl_sysdep.h" // Specification. #include "cln/ffloat.h" @@ -9,19 +9,16 @@ // Implementation. -#include "cl_FF.h" -#include "cl_N.h" -#include "cl_F.h" -#include "cl_low.h" -#include "cl_ieee.h" +#include "float/ffloat/cl_FF.h" +#include "base/cl_N.h" +#include "float/cl_F.h" +#include "base/cl_low.h" -#undef MAYBE_INLINE -#define MAYBE_INLINE inline -#include "cl_FF_zerop.cc" +#include "base/cl_inline.h" +#include "float/ffloat/elem/cl_FF_zerop.cc" namespace cln { -NEED_IEEE_FLOATS() const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) { @@ -36,20 +33,20 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) // nach Rundung mant1/mant2 >=1/2, <=2*mant1<2. // Bei mant1/mant2 >=1 brauche 23 Nachkommabits, // bei mant1/mant2 <1 brauche 24 Nachkommabits. -// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). +// Fürs Runden: brauche ein Rundungsbit (Rest gibt an, ob exakt). // Brauche daher insgesamt 25 Nachkommabits von mant1/mant2. // Dividiere daher (als Unsigned Integers) 2^25*(2^24*mant1) durch (2^24*mant2). // Falls der Quotient >=2^25 ist, runde die letzten zwei Bits weg und -// erhöhe den Exponenten um 1. +// erhöhe den Exponenten um 1. // Falls der Quotient <2^25 ist, runde das letzte Bit weg. Bei rounding // overflow schiebe um ein weiteres Bit nach rechts, incr. Exponenten. #if defined(FAST_FLOAT) && !defined(__i386__) float_to_FF(FF_to_float(x1) / FF_to_float(x2), return , TRUE, TRUE, // Overflow und subnormale Zahl abfangen - !zerop(x1), // ein Ergebnis +/- 0.0 + !zerop_inline(x1), // ein Ergebnis +/- 0.0 // ist genau dann in Wirklichkeit ein Underflow - zerop(x2), // Division durch Null abfangen - FALSE // kein NaN als Ergebnis möglich + zerop_inline(x2), // Division durch Null abfangen + FALSE // kein NaN als Ergebnis möglich ); #else // x1,x2 entpacken: @@ -63,11 +60,11 @@ const cl_FF operator/ (const cl_FF& x1, const cl_FF& x2) FF_decode(x1, { return x1; }, sign1=,exp1=,mant1=); exp1 = exp1 - exp2; // Differenz der Exponenten sign1 = sign1 ^ sign2; // Ergebnis-Vorzeichen - // Dividiere 2^25*mant1 durch mant2 oder (äquivalent) - // 2^i*2^25*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 32-24 : + // Dividiere 2^25*mant1 durch mant2 oder (äquivalent) + // 2^i*2^25*mant1 durch 2^i*mant2 für irgendein i mit 0 <= i <= 32-24 : var uintL mant; var uintL rest; - // wähle i = 32-(FF_mant_len+1), also i+(FF_mant_len+2) = 33. + // wähle i = 32-(FF_mant_len+1), also i+(FF_mant_len+2) = 33. divu_6432_3232(mant1<<1,0, mant2<<(32-(FF_mant_len+1)), mant=,rest=); if (mant >= bit(FF_mant_len+2)) // Quotient >=2^25 -> 2 Bits wegrunden