Ed If you expand the Extended Integers section (below by bob), you will see a link to an essay by Roger on 'Extended Precision Functions'. There is a Square Root verb.

   NB. long rational result may exceed line length
   sqrt 1x + *:  999999999x
1249999998750000000625000000625000000468750000156249999765624999453r1250000000000000000000000000000000000000000000000000000000
   sqrt  *:  999999999x
999999999


~ Gilles

Le 2022-04-21 à 14:50, 'robert therriault' via Programming a écrit :
Gilles,

In Nuvoc the extended constant notation can be found here 
https://code.jsoftware.com/wiki/Vocabulary/Constants#Extended_Integers

Having said that, it is hidden pretty well and most of its references are 
previous documentation on the jsoftware site. There is certainly work to be 
done on the wiki!

Cheers, bob

On Apr 21, 2022, at 11:44, Gilles Kirouac <g1...@myriade.ca> wrote:

Ed

You seem unaware of the extended precision constant notation:

"digits with a trailing x denote an extended precision integer"

https://www.jsoftware.com/help/dictionary/dcons.htm
[Where is the equivalent in NuVoc?]

I would rather write

   1x + *:  999999999x
999999998000000002

~ Gilles

Le 2022-04-21 à 12:51, Henry Rich a écrit :
    3!:0 %: x: 1 + x: *: x: 999999999
8
The square root cannot be represented exactly.
Henry Rich
On 4/21/2022 12:43 PM, Ed Gottsman wrote:
Hello.
I’m working on the Project Euler “Diophantine equation” problem (#66) and using 
J’s extended precision facilities.  I’ve run into behavior that confuses me.  
Boiled down (and overusing x: just to be sure):
     x: %: x: 1 + x: *: x: 999999999
999999999
That is (if my syntax is right), the square root of (one plus the square of a 
really large n) is n.  I’m apparently misunderstanding something about extended 
precision.  I’ve tried it with a variety of uses of x: but to no avail, and as 
I read the x: documentation…this is an odd result.

Any help would be much appreciated.
(J901 on iPadOS, for which sincere kudos to Ian Clark.)
Many thanks.
Ed
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to