in reply to Re: bigint - float?
in thread bigint - float?
$bits=int((length($bigint)-1) * 3.3219)+1;
where 3.3219 is log(10)/log(2) and the length of $bigint is relatively large assuming that length($bigint) returns the length of the string / ie number of decimals.
It also occurred to me that I could do a manual conversion to float by something like this:
$float=substr($bigint,1,1).'.'.substr($bigint,2).'e'.(length($bigint)-2);
where the point is to create a float string value out of the bigint string value...
Either of these might work, but they're a bit ugly...
j
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: length * 3.3219
by sifukurt (Hermit) on Nov 23, 2001 at 22:34 UTC |