Re: [Jprogramming] Floor of infinity

2020-08-02 Thread ethiejiesa via Programming
> So J is saying that the floor of infinity is infinity (and the ceiling of > infinity is also infinity). Since infinity is not a number, it would seem > that an error should be generated when taking the floor of infinity, or > perhaps NAN, or a zero? In any case, this messes up my nice

[Jprogramming] Floor of infinity

2020-08-02 Thread Skip Cave
I use the (=<.) verb to find integers in a list: * (=<.)1 2.5 2.7 3 4.5 6* *1 0 0 1 0 1* * (#~(=<.))1 2.5 2.7 3 4.5 6* *1 3 6* I ran across an interesting result when infinity is in the list: * (=<.)1 2.5 __ 3 4.5 6* *1 0 1 1 0 1* * (#~(=<.))1 2.5 __ 3 4.5 6* *1 __ 3 6* So J is saying

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Skip Cave
I see: (<.= >.) 1 2.5 __ 3 4.5 6 1 0 1 1 0 1 This has the same issue as (=<.) Skip Cave On Sun, Aug 2, 2020 at 7:48 AM Skip Cave wrote: > Henry said: > <. = >. > > I'll try it out: > > <. = >. 1 2.5 __ 3 4.5 6 > > 1 0 0 0 0 0 > > 0 1 0 1 0 0 > > 0 0 1 0 0 0 > > 0 0 0 0 1 0 > > 0 0 0 0 0

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Henry Rich
<. = >.    doesn't work on infinity, sorry.  But you also have trouble with big finite numbers if you allow tolerant comparison:    (=   0.5&+) 2 ^ 46 1    19j2 ": 0.5 + 2 ^ 46   70368744177664.50 Henry Rich On 8/2/2020 8:24 AM, Skip Cave wrote: What I'm really looking for, is a verb that

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Skip Cave
Henry said: <. = >. I'll try it out: <. = >. 1 2.5 __ 3 4.5 6 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 Not sure what this does? Skip On Sun, Aug 2, 2020 at 7:30 AM Henry Rich wrote: > <. = >. > > Henry Rich > > On 8/2/2020 8:24 AM, Skip Cave wrote: > > What I'm

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread 'Pascal Jasmin' via Programming
so you can combine your original test with a test for infinities ((= <.) *. -.@(e.&_ __)) ] 2.1 1 __ 0 1 0 1 0 1 1 On Sunday, August 2, 2020, 08:24:54 a.m. EDT, Skip Cave wrote: What I'm really looking for, is a verb that finds integers in a list: datatype 2.5 floating datatype

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Henry Rich
<. = >. Henry Rich On 8/2/2020 8:24 AM, Skip Cave wrote: What I'm really looking for, is a verb that finds integers in a list: datatype 2.5 floating datatype 3 integer datatype __ floating So J considers __ as "floating" So I want a verb "isinteger" that marks the integers in a

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Hauke Rehr
my finiteinteger verb (quote: finiteinteger =: ((= <.) *. (~: <:)) keepfinint =: (#~ finiteinteger) endquote) does what you want in your simple case but still, big floats may be troublesome, just as Henry pointed out Am 02.08.20 um 15:00 schrieb Skip Cave: I see: (<.= >.) 1 2.5 __ 3 4.5 6

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Raul Miller
The floor of infinity being infinity is not the real problem, opinion. Or at least not the only problem. And, integer infinity is not a particularly new concept: https://simple.wikipedia.org/wiki/Aleph_null Infinity is defined as larger than any number, and larger is not equal. Or, these sorts of

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Hauke Rehr
I was not surprised by the results. What concept of _ do you have in ^:_ if not one of an “integer?” Furthermore, (<: <: <.) *. (>: >: >.) is true for any numeric value. I think it’s obvious that _ is an identity to both (= <:) and (= >:) – and so both <. and >. must return _ as well (likewise

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Hauke Rehr
Sorry, not “_ is an identity to both (= <:) and (= >:)“ but “ _ and __ are identities to bot <: and >:” or “_ and __ are the only values satisfying both (= <:) and (= >:)” … except for NaN (_.), but that’s not exactly the topic here I think. Am 02.08.20 um 12:52 schrieb Hauke Rehr: I was not

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread ethiejiesa via Programming
Oops. > Let <. : R+ -> Z+ where (<.r) is defined to be the extended integer such > that there exists a real number s in the interval [0,1) and ((<.r)=|s-r). ((<.r)=|s-r) should be ((<.r)=r-s). -- For information about J

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Skip Cave
What I'm really looking for, is a verb that finds integers in a list: datatype 2.5 floating datatype 3 integer datatype __ floating So J considers __ as "floating" So I want a verb "isinteger" that marks the integers in a vector, where __ is in the list, and is considered floating:

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Raul Miller
I think you mean "finds elements of a list which would be representable exactly as either integers or booleans". Typically, your list will be all floating point numbers. But, also, I do not think you want to exclude 1 nor 0. This boils down to a test for fractionality with a range test. In many