The extended-precision support in J9.03 sucks. It works fine, but it is
vintage 1995. It uses a radix of 10000 - pitifully small in a day of
64-bit integers. And it doesn't use any of the fancy 256-bit
instructions that integers use. I wrote a prototype for multiplication
using FFT that was really fast, but it never made it into JE.
Wouldn't you like to replace J's extendeds with GMP or something
similar? JE has an extended-integer module that implements a few basic
functions. It should not be a big job to replace those functions with
calls to a modern library.
If anyone wants to shoulder this, I will help.
Henry Rich
On 12/16/2021 8:24 PM, Elijah Stone wrote:
r=: <:10000x^30103
NB.t=: <:2x^400000 NB. t and r have
similar magnitude
t=: _48 #.\&.|. 400000#1 NB. base 2^48
representation
M=: <.2^48
xa=: {{ (] (1&|.@] + [ - M * ]) >:&M)^:_ x+y }} NB. extended int
add, assuming padded parameters
'+~r' %&timex 'xa~t'
2.71429
NB. 2.7x faster than the builtin extended-precision numbers!
s=: 1,~0#~<:#t
'+~r' %&timex 's xa t' NB. pathological
case
0.00151854
(+~<:2x^400000) = ([ + (<.2^48) * ])/ x: |. xa~t NB. does it
actually work?
1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm