| moogie 2008-04-02, 3:59 am |
| I have yet to make a 16 bit or 24 bit version of the IEEE754 floating
point representation but have thought up working representation which
seems to work quite well... when i have a 24 bit version of the
IEEE754 representation coded i will compare the errors of both methods
to see which has the least error for my application.
here is the method i have created... not sure if it has been done
before... probably has as it is quite obvious.
public class IntFloat {
static final private int[] multiplier =
{1,10,100,1000,10000,100000,1000000,1000
0000,100000000};
static final private int[] maxNum =
{1,9,99,999,9999,99999,999999,9999999,99
999999,999999999};
static public int encode(float val,int digitsCount)
{
final int max=maxNum[digitsCount];
int count=digitsCount;
// test for outliers
if (val>max) return max*2;
if (val<-max) return 0;
// get the integer component of the input value
int temp=Math.abs((int) val);
// count the decimal places
while (temp>0)
{
temp/=10;
count--;
}
return ((int) (val*multiplier[count])+max)+(max*2+1)*c
ount;
}
static public int encodeRound(float val,int digitsCount)
{
final int max=maxNum[digitsCount];
int count=digitsCount;
// test for outliers
if (val>max) return max*2;
if (val<-max) return 0;
// get the integer component of the input value
int temp=Math.abs((int) val);
// count the decimal places
while (temp>0)
{
temp/=10;
count--;
}
return Math. round(val*multiplier[count])+max+(max*2+
1)*count;
}
static public float decode(int val,int digitsCount)
{
// get the maximum number able to be represented by the number of
digits
final int max=maxNum[digitsCount];
// calculate the total possible number of numbers able to
represented
final int temp=(max*2+1);
// extract the number of decimal places
final int count = val/temp;
// extract the digits
final int digits = val%temp;
return ((float)(digits-max))/multiplier[count];
}
}
here are some results:
digits: 1 bits needed: 6 rounding: false input: -4.6211014 -> -4.0
digits: 1 bits needed: 6 rounding: true input: -4.6211014 -> -5.0
digits: 2 bits needed: 10 rounding: false input: -4.6211014 -> -4.6
digits: 2 bits needed: 10 rounding: true input: -4.6211014 -> -4.6
digits: 3 bits needed: 13 rounding: false input: -4.6211014 -> -4.62
digits: 3 bits needed: 13 rounding: true input: -4.6211014 -> -4.62
digits: 4 bits needed: 17 rounding: false input: -4.6211014 -> -4.621
digits: 4 bits needed: 17 rounding: true input: -4.6211014 -> -4.621
digits: 5 bits needed: 21 rounding: false input: -4.6211014 -> -4.6211
digits: 5 bits needed: 21 rounding: true input: -4.6211014 -> -4.6211
digits: 6 bits needed: 24 rounding: false input: -4.6211014 -> -4.6211
digits: 6 bits needed: 24 rounding: true input: -4.6211014 -> -4.6211
digits: 7 bits needed: 28 rounding: false input: -4.6211014 ->
-4.621101
digits: 7 bits needed: 28 rounding: true input: -4.6211014 ->
-4.621101
digits: 8 bits needed: 31 rounding: false input: -4.6211014 ->
-4.6211014
digits: 8 bits needed: 31 rounding: true input: -4.6211014 ->
-4.6211014
digits: 1 bits needed: 6 rounding: false input: -9.754503 -> -9.0
digits: 1 bits needed: 6 rounding: true input: -9.754503 -> -9.0
digits: 2 bits needed: 10 rounding: false input: -9.754503 -> -9.7
digits: 2 bits needed: 10 rounding: true input: -9.754503 -> -9.8
digits: 3 bits needed: 13 rounding: false input: -9.754503 -> -9.75
digits: 3 bits needed: 13 rounding: true input: -9.754503 -> -9.75
digits: 4 bits needed: 17 rounding: false input: -9.754503 -> -9.754
digits: 4 bits needed: 17 rounding: true input: -9.754503 -> -9.755
digits: 5 bits needed: 21 rounding: false input: -9.754503 -> -9.7545
digits: 5 bits needed: 21 rounding: true input: -9.754503 -> -9.7545
digits: 6 bits needed: 24 rounding: false input: -9.754503 -> -9.7545
digits: 6 bits needed: 24 rounding: true input: -9.754503 -> -9.7545
digits: 7 bits needed: 28 rounding: false input: -9.754503 ->
-9.754503
digits: 7 bits needed: 28 rounding: true input: -9.754503 -> -9.754502
digits: 8 bits needed: 31 rounding: false input: -9.754503 ->
-9.754503
digits: 8 bits needed: 31 rounding: true input: -9.754503 -> -9.754503
digits: 1 bits needed: 6 rounding: false input: 3.2416573 -> 3.0
digits: 1 bits needed: 6 rounding: true input: 3.2416573 -> 3.0
digits: 2 bits needed: 10 rounding: false input: 3.2416573 -> 3.2
digits: 2 bits needed: 10 rounding: true input: 3.2416573 -> 3.2
digits: 3 bits needed: 13 rounding: false input: 3.2416573 -> 3.24
digits: 3 bits needed: 13 rounding: true input: 3.2416573 -> 3.24
digits: 4 bits needed: 17 rounding: false input: 3.2416573 -> 3.241
digits: 4 bits needed: 17 rounding: true input: 3.2416573 -> 3.242
digits: 5 bits needed: 21 rounding: false input: 3.2416573 -> 3.2416
digits: 5 bits needed: 21 rounding: true input: 3.2416573 -> 3.2417
digits: 6 bits needed: 24 rounding: false input: 3.2416573 -> 3.24165
digits: 6 bits needed: 24 rounding: true input: 3.2416573 -> 3.24166
digits: 7 bits needed: 28 rounding: false input: 3.2416573 -> 3.241657
digits: 7 bits needed: 28 rounding: true input: 3.2416573 -> 3.241657
digits: 8 bits needed: 31 rounding: false input: 3.2416573 ->
3.2416573
digits: 8 bits needed: 31 rounding: true input: 3.2416573 -> 3.2416573
digits: 1 bits needed: 6 rounding: false input: -1.671217 -> -1.0
digits: 1 bits needed: 6 rounding: true input: -1.671217 -> -2.0
digits: 2 bits needed: 10 rounding: false input: -1.671217 -> -1.6
digits: 2 bits needed: 10 rounding: true input: -1.671217 -> -1.7
digits: 3 bits needed: 13 rounding: false input: -1.671217 -> -1.67
digits: 3 bits needed: 13 rounding: true input: -1.671217 -> -1.67
digits: 4 bits needed: 17 rounding: false input: -1.671217 -> -1.671
digits: 4 bits needed: 17 rounding: true input: -1.671217 -> -1.671
digits: 5 bits needed: 21 rounding: false input: -1.671217 -> -1.6712
digits: 5 bits needed: 21 rounding: true input: -1.671217 -> -1.6712
digits: 6 bits needed: 24 rounding: false input: -1.671217 -> -1.67121
digits: 6 bits needed: 24 rounding: true input: -1.671217 -> -1.67122
digits: 7 bits needed: 28 rounding: false input: -1.671217 ->
-1.671217
digits: 7 bits needed: 28 rounding: true input: -1.671217 -> -1.671217
digits: 8 bits needed: 31 rounding: false input: -1.671217 ->
-1.671217
digits: 8 bits needed: 31 rounding: true input: -1.671217 -> -1.671217
digits: 1 bits needed: 6 rounding: false input: 6.523253 -> 6.0
digits: 1 bits needed: 6 rounding: true input: 6.523253 -> 7.0
digits: 2 bits needed: 10 rounding: false input: 6.523253 -> 6.5
digits: 2 bits needed: 10 rounding: true input: 6.523253 -> 6.5
digits: 3 bits needed: 13 rounding: false input: 6.523253 -> 6.52
digits: 3 bits needed: 13 rounding: true input: 6.523253 -> 6.52
digits: 4 bits needed: 17 rounding: false input: 6.523253 -> 6.523
digits: 4 bits needed: 17 rounding: true input: 6.523253 -> 6.523
digits: 5 bits needed: 21 rounding: false input: 6.523253 -> 6.5232
digits: 5 bits needed: 21 rounding: true input: 6.523253 -> 6.5233
digits: 6 bits needed: 24 rounding: false input: 6.523253 -> 6.52325
digits: 6 bits needed: 24 rounding: true input: 6.523253 -> 6.52325
digits: 7 bits needed: 28 rounding: false input: 6.523253 -> 6.523253
digits: 7 bits needed: 28 rounding: true input: 6.523253 -> 6.523253
digits: 8 bits needed: 31 rounding: false input: 6.523253 -> 6.523253
digits: 8 bits needed: 31 rounding: true input: 6.523253 -> 6.523253
digits: 1 bits needed: 6 rounding: false input: 6.120684 -> 6.0
digits: 1 bits needed: 6 rounding: true input: 6.120684 -> 6.0
digits: 2 bits needed: 10 rounding: false input: 6.120684 -> 6.1
digits: 2 bits needed: 10 rounding: true input: 6.120684 -> 6.1
digits: 3 bits needed: 13 rounding: false input: 6.120684 -> 6.12
digits: 3 bits needed: 13 rounding: true input: 6.120684 -> 6.12
digits: 4 bits needed: 17 rounding: false input: 6.120684 -> 6.12
digits: 4 bits needed: 17 rounding: true input: 6.120684 -> 6.121
digits: 5 bits needed: 21 rounding: false input: 6.120684 -> 6.1206
digits: 5 bits needed: 21 rounding: true input: 6.120684 -> 6.1207
digits: 6 bits needed: 24 rounding: false input: 6.120684 -> 6.12068
digits: 6 bits needed: 24 rounding: true input: 6.120684 -> 6.12068
digits: 7 bits needed: 28 rounding: false input: 6.120684 -> 6.120684
digits: 7 bits needed: 28 rounding: true input: 6.120684 -> 6.120684
digits: 8 bits needed: 31 rounding: false input: 6.120684 -> 6.120684
digits: 8 bits needed: 31 rounding: true input: 6.120684 -> 6.120684
digits: 1 bits needed: 6 rounding: false input: -8.864123 -> -8.0
digits: 1 bits needed: 6 rounding: true input: -8.864123 -> -9.0
digits: 2 bits needed: 10 rounding: false input: -8.864123 -> -8.8
digits: 2 bits needed: 10 rounding: true input: -8.864123 -> -8.9
digits: 3 bits needed: 13 rounding: false input: -8.864123 -> -8.86
digits: 3 bits needed: 13 rounding: true input: -8.864123 -> -8.86
digits: 4 bits needed: 17 rounding: false input: -8.864123 -> -8.864
digits: 4 bits needed: 17 rounding: true input: -8.864123 -> -8.864
digits: 5 bits needed: 21 rounding: false input: -8.864123 -> -8.8641
digits: 5 bits needed: 21 rounding: true input: -8.864123 -> -8.8641
digits: 6 bits needed: 24 rounding: false input: -8.864123 -> -8.86412
digits: 6 bits needed: 24 rounding: true input: -8.864123 -> -8.86412
digits: 7 bits needed: 28 rounding: false input: -8.864123 ->
-8.864123
digits: 7 bits needed: 28 rounding: true input: -8.864123 -> -8.864122
digits: 8 bits needed: 31 rounding: false input: -8.864123 ->
-8.864123
digits: 8 bits needed: 31 rounding: true input: -8.864123 -> -8.864123
digits: 1 bits needed: 6 rounding: false input: -8.352497 -> -8.0
digits: 1 bits needed: 6 rounding: true input: -8.352497 -> -8.0
digits: 2 bits needed: 10 rounding: false input: -8.352497 -> -8.3
digits: 2 bits needed: 10 rounding: true input: -8.352497 -> -8.4
digits: 3 bits needed: 13 rounding: false input: -8.352497 -> -8.35
digits: 3 bits needed: 13 rounding: true input: -8.352497 -> -8.35
digits: 4 bits needed: 17 rounding: false input: -8.352497 -> -8.352
digits: 4 bits needed: 17 rounding: true input: -8.352497 -> -8.352
digits: 5 bits needed: 21 rounding: false input: -8.352497 -> -8.3524
digits: 5 bits needed: 21 rounding: true input: -8.352497 -> -8.3525
digits: 6 bits needed: 24 rounding: false input: -8.352497 -> -8.35249
digits: 6 bits needed: 24 rounding: true input: -8.352497 -> -8.3525
digits: 7 bits needed: 28 rounding: false input: -8.352497 ->
-8.352497
digits: 7 bits needed: 28 rounding: true input: -8.352497 -> -8.352497
digits: 8 bits needed: 31 rounding: false input: -8.352497 ->
-8.352497
digits: 8 bits needed: 31 rounding: true input: -8.352497 -> -8.352497
digits: 1 bits needed: 6 rounding: false input: 4.4585996 -> 4.0
digits: 1 bits needed: 6 rounding: true input: 4.4585996 -> 4.0
digits: 2 bits needed: 10 rounding: false input: 4.4585996 -> 4.4
digits: 2 bits needed: 10 rounding: true input: 4.4585996 -> 4.5
digits: 3 bits needed: 13 rounding: false input: 4.4585996 -> 4.45
digits: 3 bits needed: 13 rounding: true input: 4.4585996 -> 4.46
digits: 4 bits needed: 17 rounding: false input: 4.4585996 -> 4.458
digits: 4 bits needed: 17 rounding: true input: 4.4585996 -> 4.459
digits: 5 bits needed: 21 rounding: false input: 4.4585996 -> 4.4585
digits: 5 bits needed: 21 rounding: true input: 4.4585996 -> 4.4586
digits: 6 bits needed: 24 rounding: false input: 4.4585996 -> 4.45859
digits: 6 bits needed: 24 rounding: true input: 4.4585996 -> 4.4586
digits: 7 bits needed: 28 rounding: false input: 4.4585996 -> 4.458599
digits: 7 bits needed: 28 rounding: true input: 4.4585996 -> 4.4586
digits: 8 bits needed: 31 rounding: false input: 4.4585996 ->
4.4585996
digits: 8 bits needed: 31 rounding: true input: 4.4585996 -> 4.4585996
digits: 1 bits needed: 6 rounding: false input: 1.186054 -> 1.0
digits: 1 bits needed: 6 rounding: true input: 1.186054 -> 1.0
digits: 2 bits needed: 10 rounding: false input: 1.186054 -> 1.1
digits: 2 bits needed: 10 rounding: true input: 1.186054 -> 1.2
digits: 3 bits needed: 13 rounding: false input: 1.186054 -> 1.18
digits: 3 bits needed: 13 rounding: true input: 1.186054 -> 1.19
digits: 4 bits needed: 17 rounding: false input: 1.186054 -> 1.186
digits: 4 bits needed: 17 rounding: true input: 1.186054 -> 1.186
digits: 5 bits needed: 21 rounding: false input: 1.186054 -> 1.186
digits: 5 bits needed: 21 rounding: true input: 1.186054 -> 1.1861
digits: 6 bits needed: 24 rounding: false input: 1.186054 -> 1.18605
digits: 6 bits needed: 24 rounding: true input: 1.186054 -> 1.18605
digits: 7 bits needed: 28 rounding: false input: 1.186054 -> 1.186054
digits: 7 bits needed: 28 rounding: true input: 1.186054 -> 1.186054
digits: 8 bits needed: 31 rounding: false input: 1.186054 -> 1.186054
digits: 8 bits needed: 31 rounding: true input: 1.186054 -> 1.186054
digits: 1 bits needed: 6 rounding: false input: 1.9845427 -> 1.0
digits: 1 bits needed: 6 rounding: true input: 1.9845427 -> 2.0
digits: 2 bits needed: 10 rounding: false input: 1.9845427 -> 1.9
digits: 2 bits needed: 10 rounding: true input: 1.9845427 -> 2.0
digits: 3 bits needed: 13 rounding: false input: 1.9845427 -> 1.98
digits: 3 bits needed: 13 rounding: true input: 1.9845427 -> 1.98
digits: 4 bits needed: 17 rounding: false input: 1.9845427 -> 1.984
digits: 4 bits needed: 17 rounding: true input: 1.9845427 -> 1.985
digits: 5 bits needed: 21 rounding: false input: 1.9845427 -> 1.9845
digits: 5 bits needed: 21 rounding: true input: 1.9845427 -> 1.9845
digits: 6 bits needed: 24 rounding: false input: 1.9845427 -> 1.98454
digits: 6 bits needed: 24 rounding: true input: 1.9845427 -> 1.98454
digits: 7 bits needed: 28 rounding: false input: 1.9845427 -> 1.984542
digits: 7 bits needed: 28 rounding: true input: 1.9845427 -> 1.984543
digits: 8 bits needed: 31 rounding: false input: 1.9845427 ->
1.9845428
digits: 8 bits needed: 31 rounding: true input: 1.9845427 -> 1.9845428
digits: 1 bits needed: 6 rounding: false input: 8.604827 -> 8.0
digits: 1 bits needed: 6 rounding: true input: 8.604827 -> 9.0
digits: 2 bits needed: 10 rounding: false input: 8.604827 -> 8.6
digits: 2 bits needed: 10 rounding: true input: 8.604827 -> 8.6
digits: 3 bits needed: 13 rounding: false input: 8.604827 -> 8.6
digits: 3 bits needed: 13 rounding: true input: 8.604827 -> 8.6
digits: 4 bits needed: 17 rounding: false input: 8.604827 -> 8.604
digits: 4 bits needed: 17 rounding: true input: 8.604827 -> 8.605
digits: 5 bits needed: 21 rounding: false input: 8.604827 -> 8.6048
digits: 5 bits needed: 21 rounding: true input: 8.604827 -> 8.6048
digits: 6 bits needed: 24 rounding: false input: 8.604827 -> 8.60482
digits: 6 bits needed: 24 rounding: true input: 8.604827 -> 8.60483
digits: 7 bits needed: 28 rounding: false input: 8.604827 -> 8.604827
digits: 7 bits needed: 28 rounding: true input: 8.604827 -> 8.604828
digits: 8 bits needed: 31 rounding: false input: 8.604827 -> 8.604827
digits: 8 bits needed: 31 rounding: true input: 8.604827 -> 8.604827
digits: 1 bits needed: 6 rounding: false input: 2.4342284 -> 2.0
digits: 1 bits needed: 6 rounding: true input: 2.4342284 -> 2.0
digits: 2 bits needed: 10 rounding: false input: 2.4342284 -> 2.4
digits: 2 bits needed: 10 rounding: true input: 2.4342284 -> 2.4
digits: 3 bits needed: 13 rounding: false input: 2.4342284 -> 2.43
digits: 3 bits needed: 13 rounding: true input: 2.4342284 -> 2.43
digits: 4 bits needed: 17 rounding: false input: 2.4342284 -> 2.434
digits: 4 bits needed: 17 rounding: true input: 2.4342284 -> 2.434
digits: 5 bits needed: 21 rounding: false input: 2.4342284 -> 2.4342
digits: 5 bits needed: 21 rounding: true input: 2.4342284 -> 2.4342
digits: 6 bits needed: 24 rounding: false input: 2.4342284 -> 2.43422
digits: 6 bits needed: 24 rounding: true input: 2.4342284 -> 2.43423
digits: 7 bits needed: 28 rounding: false input: 2.4342284 -> 2.434228
digits: 7 bits needed: 28 rounding: true input: 2.4342284 -> 2.434229
digits: 8 bits needed: 31 rounding: false input: 2.4342284 ->
2.4342284
digits: 8 bits needed: 31 rounding: true input: 2.4342284 -> 2.4342284
digits: 1 bits needed: 6 rounding: false input: -5.3472214 -> -5.0
digits: 1 bits needed: 6 rounding: true input: -5.3472214 -> -5.0
digits: 2 bits needed: 10 rounding: false input: -5.3472214 -> -5.3
digits: 2 bits needed: 10 rounding: true input: -5.3472214 -> -5.3
digits: 3 bits needed: 13 rounding: false input: -5.3472214 -> -5.34
digits: 3 bits needed: 13 rounding: true input: -5.3472214 -> -5.35
digits: 4 bits needed: 17 rounding: false input: -5.3472214 -> -5.347
digits: 4 bits needed: 17 rounding: true input: -5.3472214 -> -5.347
digits: 5 bits needed: 21 rounding: false input: -5.3472214 -> -5.3472
digits: 5 bits needed: 21 rounding: true input: -5.3472214 -> -5.3472
digits: 6 bits needed: 24 rounding: false input: -5.3472214 ->
-5.34722
digits: 6 bits needed: 24 rounding: true input: -5.3472214 -> -5.34722
digits: 7 bits needed: 28 rounding: false input: -5.3472214 ->
-5.347221
digits: 7 bits needed: 28 rounding: true input: -5.3472214 ->
-5.347221
digits: 8 bits needed: 31 rounding: false input: -5.3472214 ->
-5.3472214
digits: 8 bits needed: 31 rounding: true input: -5.3472214 ->
-5.3472214
digits: 1 bits needed: 6 rounding: false input: -6.4792013 -> -6.0
digits: 1 bits needed: 6 rounding: true input: -6.4792013 -> -6.0
digits: 2 bits needed: 10 rounding: false input: -6.4792013 -> -6.4
digits: 2 bits needed: 10 rounding: true input: -6.4792013 -> -6.5
digits: 3 bits needed: 13 rounding: false input: -6.4792013 -> -6.47
digits: 3 bits needed: 13 rounding: true input: -6.4792013 -> -6.48
digits: 4 bits needed: 17 rounding: false input: -6.4792013 -> -6.479
digits: 4 bits needed: 17 rounding: true input: -6.4792013 -> -6.479
digits: 5 bits needed: 21 rounding: false input: -6.4792013 -> -6.4792
digits: 5 bits needed: 21 rounding: true input: -6.4792013 -> -6.4792
digits: 6 bits needed: 24 rounding: false input: -6.4792013 -> -6.4792
digits: 6 bits needed: 24 rounding: true input: -6.4792013 -> -6.4792
digits: 7 bits needed: 28 rounding: false input: -6.4792013 ->
-6.479201
digits: 7 bits needed: 28 rounding: true input: -6.4792013 ->
-6.479201
digits: 8 bits needed: 31 rounding: false input: -6.4792013 ->
-6.4792013
digits: 8 bits needed: 31 rounding: true input: -6.4792013 ->
-6.4792013
digits: 1 bits needed: 6 rounding: false input: 6.226822 -> 6.0
digits: 1 bits needed: 6 rounding: true input: 6.226822 -> 6.0
digits: 2 bits needed: 10 rounding: false input: 6.226822 -> 6.2
digits: 2 bits needed: 10 rounding: true input: 6.226822 -> 6.2
digits: 3 bits needed: 13 rounding: false input: 6.226822 -> 6.22
digits: 3 bits needed: 13 rounding: true input: 6.226822 -> 6.23
digits: 4 bits needed: 17 rounding: false input: 6.226822 -> 6.226
digits: 4 bits needed: 17 rounding: true input: 6.226822 -> 6.227
digits: 5 bits needed: 21 rounding: false input: 6.226822 -> 6.2268
digits: 5 bits needed: 21 rounding: true input: 6.226822 -> 6.2268
digits: 6 bits needed: 24 rounding: false input: 6.226822 -> 6.22682
digits: 6 bits needed: 24 rounding: true input: 6.226822 -> 6.22682
digits: 7 bits needed: 28 rounding: false input: 6.226822 -> 6.226822
digits: 7 bits needed: 28 rounding: true input: 6.226822 -> 6.226822
digits: 8 bits needed: 31 rounding: false input: 6.226822 -> 6.226822
digits: 8 bits needed: 31 rounding: true input: 6.226822 -> 6.226822
digits: 1 bits needed: 6 rounding: false input: -5.2254853 -> -5.0
digits: 1 bits needed: 6 rounding: true input: -5.2254853 -> -5.0
digits: 2 bits needed: 10 rounding: false input: -5.2254853 -> -5.2
digits: 2 bits needed: 10 rounding: true input: -5.2254853 -> -5.2
digits: 3 bits needed: 13 rounding: false input: -5.2254853 -> -5.22
digits: 3 bits needed: 13 rounding: true input: -5.2254853 -> -5.23
digits: 4 bits needed: 17 rounding: false input: -5.2254853 -> -5.225
digits: 4 bits needed: 17 rounding: true input: -5.2254853 -> -5.225
digits: 5 bits needed: 21 rounding: false input: -5.2254853 -> -5.2254
digits: 5 bits needed: 21 rounding: true input: -5.2254853 -> -5.2255
digits: 6 bits needed: 24 rounding: false input: -5.2254853 ->
-5.22548
digits: 6 bits needed: 24 rounding: true input: -5.2254853 -> -5.22549
digits: 7 bits needed: 28 rounding: false input: -5.2254853 ->
-5.225485
digits: 7 bits needed: 28 rounding: true input: -5.2254853 ->
-5.225485
digits: 8 bits needed: 31 rounding: false input: -5.2254853 ->
-5.2254853
digits: 8 bits needed: 31 rounding: true input: -5.2254853 ->
-5.2254853
digits: 1 bits needed: 6 rounding: false input: -7.8341875 -> -7.0
digits: 1 bits needed: 6 rounding: true input: -7.8341875 -> -8.0
digits: 2 bits needed: 10 rounding: false input: -7.8341875 -> -7.8
digits: 2 bits needed: 10 rounding: true input: -7.8341875 -> -7.8
digits: 3 bits needed: 13 rounding: false input: -7.8341875 -> -7.83
digits: 3 bits needed: 13 rounding: true input: -7.8341875 -> -7.83
digits: 4 bits needed: 17 rounding: false input: -7.8341875 -> -7.834
digits: 4 bits needed: 17 rounding: true input: -7.8341875 -> -7.834
digits: 5 bits needed: 21 rounding: false input: -7.8341875 -> -7.8341
digits: 5 bits needed: 21 rounding: true input: -7.8341875 -> -7.8342
digits: 6 bits needed: 24 rounding: false input: -7.8341875 ->
-7.83418
digits: 6 bits needed: 24 rounding: true input: -7.8341875 -> -7.83419
digits: 7 bits needed: 28 rounding: false input: -7.8341875 ->
-7.834187
digits: 7 bits needed: 28 rounding: true input: -7.8341875 ->
-7.834187
digits: 8 bits needed: 31 rounding: false input: -7.8341875 ->
-7.834187
digits: 8 bits needed: 31 rounding: true input: -7.8341875 ->
-7.834187
|