Re: [Jprogramming] Extended precision question

2022-04-27 Thread Ed Gottsman
Project Euler #66, extended precision integer square roots, no spoilers Continuing the discussion, for which again thank you all: I found that what I really wanted was large *integer* square roots. Since this seems to come up frequently in Project Euler problems and since I believe there are E

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Ed Gottsman
Oops. Foolish error as I prepared for presentation. My apologies. Here’s the accurate implementation of intsqrt. intsqrt =: 3 : 0 NB. y An array of possible integer squares NB. Return 0 for non-squares or integer roots s * y = x: *: s =. <. 0.5 + x: 10 ^ -: x: 10 ^. y ) Note that it is explici

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Raul Miller
You should have used squares =: *: x: >: ? 1e5 $ 1e11 Computing the square using floating point and then converting to extended precision means that many of your values in 'squares' are not actually square. For example: x: *: 68824904566 4736867488519007764480 *: x: 68824904566 47368674

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Hauke Rehr
What keeps you from writing your comments vertically‽ Am 27.04.22 um 14:50 schrieb Ed Gottsman: If J were written vertically, it might be easier to comment. -- -- mail written using NEO neo-layout.org -- Fo

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Raul Miller
For what it's worth, J could easily be written vertically. But that's probably not quite what people would want. vertical=: {{ 0!:0;:inv{.@;:;._2 m}} {{)n mean =: + / % # }}vertical mean 1 2 3 2 -- Raul On Wed, Apr 27, 2022 at 2:01 PM Hauke Rehr wrote: > > Wha

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Elijah Stone
I thought what was wanted was to write the _comments_ vertically, as in: mean=: +/ % # NB. i sr d l NB. s ue i e NB.md v n NB. u i g NB. c d t NB. t e h NB. i d NB. o NB. n b NB. y On Wed, 27 Apr 2022, Raul Miller wrote: For what it's worth, J could easily

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Raul Miller
Probably more like vert=: {{0!:0;:inv@;;.1 a:,<@}:@;:@,&' NB.';._2 m}} {{)n NB. y Possible squares of integers. Return either integer NB. square roots or 0s. intsqrt=: {{ y * NB. Multiply to produce either integer square roots or 0s y = NB. 1s where the calculated square

[Jprogramming] Report on the J Wiki Meeting of April 21, 2022

2022-04-27 Thread 'robert therriault' via Programming
Present: Art Anger, Devon McCormick, Raul Miller, Bob Therriault • A discussion of the J playground and the progress that it is making. Wondering about the value of creating a video that outlines a good process for users to provide feedback in the process. • A discussion about vi

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Ed Gottsman
LOL. Fair question. Here’s another: if J adopted a style standard around ideograms (which are rendered vertically by default) for comments, would that on the one hand slightly increase (as a percentage) its reputation for obscurity among Western programmers but on the other dramatically increa

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Ed Gottsman
Raul, D’oh. *Sigh*. It helps. Many thanks. I appreciate your patience as much as your knowledge and willingness to help. Ed Sent from my iPad > On Apr 27, 2022, at 3:36 PM, Raul Miller wrote: > > You should have used > squares =: *: x: >: ? 1e5 $ 1e11 > > Computing the square using f

Re: [Jprogramming] Extended precision question

2022-04-27 Thread Hauke Rehr
The LEO editor might be a good fit. And yes, it’s really freaking (cool). A script could generate the actual .ijs from snippets that are well documented and those snippets may well be single J tokens. Am 28.04.22 um 08:10 schrieb Ed Gottsman: LOL. Fair question. Here’s another: if J adopted a