Actually, this is very odd... DP=:40 ln=: DP&$: : (4 : 0) " 0 echo 'ln ',":y assert. 0<y m=. <.0.5+2^.y t=. (<:%>:) (x:!.0 y)%2x^m if. x<-:#":t do. t=. (1+x) round t end. ln2=. 2*+/1r3 (^%]) 1+2*i.>.0.5*(%3)^.0.5*0.1^x+>.10^.1>.m lnr=. 2*+/t (^%]) 1+2*i.>.0.5*(|t)^.0.5*0.1^x lnr + m * ln2 ) 0j4":ln 2 3 ln 2 0.6931 43.0000
Where does the 43 even come from? -- Raul On Sat, Oct 10, 2020 at 8:42 PM Raul Miller <[email protected]> wrote: > > I can reproduce this problem. > > Defining DP=:40 and then defining ln, under j902 beta-h: > 0j4":ln 2 > 0.6931 > 0j4":ln 3 > 1.0986 > 0j4":ln 2 3 > 0.6931 43.0000 > > Doing the same under j807: > 0j4":ln 2 > 0.6931 > 0j4":ln 3 > 1.0986 > 0j4":ln 2 3 > 0.6931 1.0986 > > Thanks, > > -- > Raul > > On Sat, Oct 10, 2020 at 4:39 PM Don Guinn <[email protected]> wrote: > > > > Playing with Roger's page for calculating extended precision > > transcendental functions, "Essays/Extended_Precision_Functions", I found an > > error in Beta J, not his definitions. There appears to be an error in the > > handling of $: as to the rank of monadic "ln". Probably other functions in > > the essay have the same problem. In trying to better isolate the problem I > > had a J crash and a stack error. Hopefully the miscalculation and the stack > > error are sufficient to isolate the error; however, I can send the J crash > > if necessary. > > > > In J6 it treats the modac rank of ln as 0, but it is unclear what the > > monadic rank of ln is. > > > > This is the original problem: > > > > ln=: DP&$: : (4 : 0) " 0 > > assert. 0<y > > m=. <.0.5+2^.y > > t=. (<:%>:) (x:!.0 y)%2x^m > > if. x<-:#":t do. t=. (1+x) round t end. > > ln2=. 2*+/1r3 (^%]) 1+2*i.>.0.5*(%3)^.0.5*0.1^x+>.10^.1>.m > > lnr=. 2*+/t (^%]) 1+2*i.>.0.5*(|t)^.0.5*0.1^x > > lnr + m * ln2 > > ) > > > > 0j20":ln 2 3 > > > > 0.69314718055994530942 43.00000000000000000000 > > > > > > Obviously not the ln of 3. This gives the correct answer in J8.07 but is > > also wrong in J9.01 . > > > > > > This results in a stack error: > > > > > > add=:(4 : 0)"0 > > > > echo 'Running add ',":x,y > > > > x+y > > > > ) > > > > p=:DP&$: : (4 : 0) " 0 > > > > x add y > > > > ) > > > > p 2 3 > > > > |stack error: p > > > > | p 2 3 > > > > |[-9] > > > > JVERSION > > > > Engine: j902/j64avx2/windows > > > > Beta-h: commercial/2020-10-03T19:50:26 > > > > Library: 9.02.06 > > > > Qt IDE: 1.8.7/5.12.7(5.12.7) > > > > Platform: Win 64 > > > > Installer: J902 install > > > > InstallPath: c:/j902 > > > > Contact: www.jsoftware.com > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
