debugged bitvector mantissa

This commit is contained in:
Jiri Pittner 2022-07-05 21:19:09 +02:00
parent 31858216be
commit bcec9491f7
2 changed files with 15 additions and 3 deletions

View File

@ -101,10 +101,10 @@ if(x<0||x>=1) laerror("number not normalized in bitvector mantissa");
bitvector b(nbits);
b.clear();
T y= x+x;
for(int i=0; i<nbits; ++i)
for(int i=0; i<nbits-1; ++i)
{
int n= (int) y;
if(n&1) b.set(i);
if(n&1) b.set(i+1);
y += y;
}
return b;

14
t.cc
View File

@ -2585,11 +2585,23 @@ x.concatme(y);
cout <<x;
}
if(1)
if(0)
{
double x;
cin>>x;
cout <<mantissa(x,20)<<endl;
}
if(1)
{
double t,t2;
cin>>t;
bitvector m = mantissa(t,64);
cout <<m<<std::endl;
bitvector_decimal(t2,m);
cout <<t2;
}
}