I agree with your contention  on the basis that _3.15 = -(3.15) or _3 +_0.15

and your  use of   what I named   fp1=:* * 1 | | does this

For the real part   rp1=: ] - fp1

v

_2.375 _5.84615 _11.4 13.0028 13.0014 13 12.9986

fp1 v

_0.375 _0.84615 _0.4 0.0028 0.0014 0 0.9986

rp1 v

_2 _5 _11 13 13 13 12

Don Kelly


On 2017-08-09 2:21 PM, Skip Cave wrote:
Bo said:
v=(<.v)+(1|v) NB. number = integer part + fractional part? Yes!

True. However, if
       ]v=:2%(3r19-%1 2 3 245 246 247 248)
_2.375 _5.84615 _11.4 13.0028 13.0014 13 12.9986

And we define the fractional part of v your way:

     1|v

0.625 0.153846 0.6 0.0027933 0.00139082 0 0.998621

I contend that 0.0625 is NOT the fractional part of _2.375, at least not in
my eyes. It may be the residue of a division by one, but that isn't what I
call a fractional part of a negative number (except maybe in 2s complement
binary)

Also, using your definition of the integer part:

      ]v=:2%(3r19-%1 2 3 245 246 247 248)
_2.375 _5.84615 _11.4 13.0028 13.0014 13 12.9986

       <. v

_3 _6 _12 13 13 13 12

_3 _6 _12 isn't the integer part of  _2.375 _5.84615 _11.4

However, as you say:

      v=(<.v)+(1|v)

1 1 1 1 1 1 1

So my test for finding the correct fractional and integer parts of a number
by adding the two parts together are not sufficient to determine if the ip
and fp are the correct values.


Skip
----------------------------------------------------------------------
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