4 #include "base/cl_sysdep.h"
14 float_format_t float_format (uintE n)
17 // Mindestens 1+n Dezimalstellen (inklusive Vorkommastelle)
18 // bedeutet mindestens ceiling((1+n)*ln(10)/ln(2)) Binärstellen.
19 // ln(10)/ln(2) = 3.321928095 = (binär) 11.010100100110100111100001001011110011010...
20 // = (binär) 100 - 0.101011011001011000011110110100001100101...
21 // Durch diese Berechnungsmethode wird das Ergebnis sicher >= (1+n)*ln(10)/ln(2)
22 // sein, evtl. um ein paar Bit zu groß aber nicht zu klein.
24 return (float_format_t)
26 - (n >> 1) - (n >> 3) - (n >> 5) - (n >> 6)
27 - (n >> 8) - (n >> 9) - (n >> 12) - (n >> 14)
28 - (n >> 15) - (n >> 20) - (n >> 21) - (n >> 22)
29 - (n >> 23) - (n >> 25) - (n >> 26) - (n >> 28)
31 - (n >> 33) - (n >> 34) - (n >> 37) - (n >> 39)