Thank you for the pointer, that Phrases page also has expressions for other numbers
http://www.jsoftware.com/books/help/phrases/numbers_counting.htm Good idea to use the root formula too. 2 %~ 1 + %:5 1.61803 And expression for the square root (2 %~ ] + %)^:_~ 5 2.23607 %:5 2.23607 Fast converging, too 0j20":"0 (2 %~ ] + %)^:(<_)~ 5 5.00000000000000000000 3.00000000000000000000 2.33333333333333350000 2.23809523809523810000 2.23606889564336340000 2.23606797749997810000 2.23606797749978980000 In Elementary Functions, K.E.Iverson, 1966, there is a square root algorithm that can be translated with default tolerance like this sr=: 3 : 0 a=. c=. y while. d=. * y-*:a do. a=. a [EMAIL PROTECTED] c=. c%2 end. ) sr 5 2.23607 Or tacitly {. ({.`({.+{:)`({.-{:)@.(1&{ [EMAIL PROTECTED] *:@{.) ,1&{,-:@{:)^:_ (],],-:) 5 NB. a,p,c 2.23607 ----- Original Message ---- From: John Randall <[EMAIL PROTECTED]> To: Programming forum <[email protected]> Sent: Monday, July 10, 2006 3:58:59 PM Subject: Re: [Jprogramming] 1000 golden digits Oleg Kobchenko wrote: > Is there an established routine to get > arbitrary decimal precision number calculations? For square roots, there is Phrase 8A d85 (updated below to J601), which gives x digits of the square root of integer y: sqrt=:4 : '-:@(+y&%)^:(>.2^.1>.x-16) x:%:y' Then you can do the golden ratio as something like 0j100 ": -:>: (101 sqrt 5) 1.6180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911375 Best wishes, John ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
