High Precision Arithmetic 
Author Message
 High Precision Arithmetic

I am using some string functions to work with 96 bit integers in Turbo
Pascal but they are so SLOW. Currently I store each 32 bits separately
and then feed them into the string functions                            

Would anyone be able to supply me either with some assembly language or
other code that would do the job more efficiently or a contact where I
can get such code. I need addition, subtraction, multiplication, division
and modulo funtions particularly. Truncation and rounding functions would
be a bonus.

Tim Bourke



Wed, 18 Jun 1902 08:00:00 GMT  
 High Precision Arithmetic

Would not the build in data type Comp suffice (integer data type of the
floating point coprocessor)? I never had any overflow with those.



Wed, 18 Jun 1902 08:00:00 GMT  
 High Precision Arithmetic

96 bit numbers require 29 digits, more than the comp type has. I tried
using Turbo Power's BCD arithmetic but bugs appeared from the package
once the default precision was changed upward (from 18 digits) in
particular the division operation failed.

Tim Bourke



Wed, 18 Jun 1902 08:00:00 GMT  
 High Precision Arithmetic



Quote:
>I am using some string functions to work with 96 bit integers in Turbo
>Pascal but they are so SLOW. Currently I store each 32 bits separately
>and then feed them into the string functions                    

>Would anyone be able to supply me either with some assembly language or
>other code that would do the job more efficiently or a contact where I
>can get such code. I need addition, subtraction, multiplication, division
>and modulo funtions particularly. Truncation and rounding functions would
>be a bonus.

Don't use strings (except as a means of getting round TP's inability to
return other than "simple" types as function results).

Store your 96 bits as array [1..6] of word, and do long arithmetic to
base 65536 in the same way as you learnt arithmetic to base 10 at school
(if you are young, ask someone who went to school before around 1960).
With {$R-} I think you'll be OK with word*word -> longint ; if not, use
array [1..12] of byte.

--

     http://www.merlyn.demon.co.uk/



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. getting high precision arithmetic for BP7

2. Arithmetic in multiple precision

3. multiple precision arithmetic

4. High precision timing

5. High Precision Timing

6. Rounding Off or Precision Error

7. Currency Field lossing precision

8. Precision Timer

9. Real precision

10. HELP !!! Table field precision

11. Precision calculations

12. proper way to use single and double precision?

 

 
Powered by phpBB® Forum Software