I think you have assumed that the user will use these with "0 or only
on atomic numbers?

Thanks,

-- 
Raul


On Wed, Aug 9, 2017 at 3:39 PM, Louis de Forcrand <ol...@bluewin.ch> wrote:
> A few handy tests which are good to know:
>
> N=: GI *. 1 0 e.~ * NB. naturals
> Z=: GI *. R NB. integers
> R=: = + NB. reals
> C_R=: + = - NB. pure imaginaries (C-.R)
> GI=: = <. NB. gaussian integers
>
> These were made to accept any J number. They could be optimised if one knows 
> that they are working only with real numbers, for example. In that case
>
> 1 0 e.~ *
>
> could be replaced by
>
>>:&0
>
> and the test for reals can be skipped in Z.
>
> In addition, these work with the mathematical definitions of the different 
> number sets, not with J's internal storage types.
>
> Louis
>
>> On 9 Aug 2017, at 11:42, Skip Cave <s...@caveconsulting.com> wrote:
>>
>> Martin,
>>
>> The original problem I was working on was a post on Quora (
>> https://goo.gl/NrZde2). I use these Quora math questions to help sharpen my
>> J skills. I try to see if I can "brute force" the solutions using J, while
>> most other posters try to solve these things by algebraic manipulation.  My
>> answer to that question is here: (https://goo.gl/FhdJAg). There are several
>> Quora problems that I have posted J solutions for, mostly to show how
>> simple a brute force solution can be when using an array language. You can
>> find those posts by searching for my name ("Skip Cave") in Quora
>>
>> In this problem all I really needed to do was to find all the results from
>> the equation that were integers, so I used the 0=1||  scheme to find them.
>>
>> Our discussion on the J forum got me thinking about finding both the
>> fractional part and the integer part of numbers, and I thought the pair of
>> verbs (fp, ip) would be a nice addition to the Phrases doc, which is
>> defined as listing phrases "useful to beginners in learning the language,
>> and of continuing use to practical programmers."
>>
>> Also, when I obtained the fractional part, I wanted to keep the fact that
>> the fractional part came from a negative number, hence the attempt to have
>> negative fractional parts.
>>
>> Skip
>>
>> Skip Cave
>> Cave Consulting LLC
>>
>>> On Wed, Aug 9, 2017 at 9:35 AM, Martin Kreuzer <i...@airkreuzer.com> wrote:
>>>
>>> From what I've gathered so far is, that people seem to not mind that much,
>>> when extracting the fractional part from a (negative) float, they use
>>>
>>>   (1&|) _8.11
>>> 0.89
>>>
>>> or
>>>
>>>   (1&#:) _8.11
>>> 0.89
>>>
>>> or
>>>
>>>   (**1||) _8.11
>>> _0.11
>>>
>>> as long as the integer and fractional part added up produce the original
>>> float value.
>>>
>>> Q: Would somebody care to give a (scaled down) real-world example so as to
>>> give me a chance to understand where this ip/fp extraction usually comes
>>> into play and what part of the data is used for decision-making..? Thanks.
>>>
>>> -M
>>>
>>>
>>>
>> ----------------------------------------------------------------------
>> 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