array shifter - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7) +---- Thread: array shifter (/showthread.php?tid=907) Pages:
1
2
|
array shifter - Jack - 09-21-2022 for multi-precision binary addition and subtraction you need multi-precision shifts to align the decimal point, here are some functions to shift an array of longs Code: (Select All) _Title "array-shifter" RE: array shifter - Pete - 09-22-2022 Bit shifting... oh the horror!!! :O Pete RE: array shifter - Jack - 09-22-2022 I did a binary floating point package in FreeBasic, the arithmetic functions are better than 2 times faster than the decimal version but the conversion routines are a horror when I started writing the routines I had no easy way to debug the result, I needed the arithmetic functions in order to implement the conversion routines, almost like a catch 22 RE: array shifter - bplus - 09-22-2022 I've been thinking about the conversions and as with powers in binary, tables might be necessary especially for extended precision. RE: array shifter - Jack - 09-22-2022 bplus I think that you are on the right track, I have seen the use of tables in binary conversion, it's just that I have not taken the trouble to learn how to use them the tables for binary floating point conversion were negative and positive powers of 10 what I did instead was to get an estimate of the power of ten needed and then raise 10 to that power in a temporary variable RE: array shifter - bplus - 09-22-2022 1011.01001011 = 2^3 + 2^1 + 2^0 + 2^-2 + 2^-5 + 2^-7 + 2^-8 Table: -100 to 100 = 201 lines 2 ^ -100 = 1/1,267,650,600,228,229,401,496,703,205,376 Pete can get that for you . . . 2^-3 =.125 2^-2 =.25 2^-1 =.5 2^ 0 = 1 2^1 = 2 2^2 = 4 . . . 2^ 100 = 1,267,650,600,228,229,401,496,703,205,376 RE: array shifter - Jack - 09-22-2022 good example bplus but it's more complicated with a binary floating point number with some high exponent RE: array shifter - Pete - 09-22-2022 .00000000000000000000000000000007888609052210118054117285652827862296732064351090230047702789306640625 RE: array shifter - bplus - 09-22-2022 oops! Pete you might be off a zero, all the non zero digits look good: RE: array shifter - Pete - 09-22-2022 It is off by 1. I used some code I have in progress to make that calculation. So my old system got it right, but something is amiss with some new code I'm putting together while trying out some long division ideas for nth roots. I will investigate. Thanks! Pete EDIT: ...and I found it. In the betatest text I had a duplicate of the decimal adjustment statement. That threw in an extra decimal point. .0000000000000000000000000000007888609052210118054117285652827862296732064351090230047702789306640625 |