> So, if ever Roger "fixes"  %  (such that  0 -:&:(3!:3) 0%_1  ) and 
> any other primitives which can name the beast, J will still have a 
> negative zero (because the IEEE floating point standard calls for it).

This is false.  If I put in code to eradicate
"minus zero" in all the places (including in 
3!:x) that can generate "minus zero", and it is 
possible to put in such code, then there would be 
no minus zero in J.  But then what would we have
bought in return for the exorbitant cost?



----- Original Message -----
From: Dan Bron <[EMAIL PROTECTED]>
Date: Monday, April 23, 2007 8:08 am
Subject: RE: [Jgeneral] zero

> Jose wrote:
> 
> >   0 ((-: ; ;)& (3!:3)) _0
> 
> This is not surprising;  except for rationals and extended ints, J 
> ignores any symbols in constants which do not effect the value.  
> So  0.0  is boolean, as is  0j0  as  is  0x0.0j_0e_1  , etc (A).
> 
> >   0 ((-: ; ;)& (3!:3)) -0
> 
> The result of  -0  isn't negative, it's merely integer.  One way 
> to tell if you've generated a true negative zero is to look at its 
> reciprocal.  The reciprocal of regular  0  is positive infinity, 
> the reciprocal of negative zero is negative infinity.  Thus:
> 
>           %0
>       _
>           %_0
>       _
>           %-0
>       _
>           %  0%_1
>       __
> 
> Note that negative zeros must be floating or complex.  No other 
> numeric type can represent a negative zero.
>           
> >Then again, the function 3!:3 can distinguish between 0 and -0,
> 
> Right.  A nice insight here is that  3!:3  can be used to 
> __generate__ a negative zero.  Henry Rich once posed a challenge 
> to find ways to generate negative zero (B).  Here was one of my 
> submissions (C):
> 
> 
>           i_1  =.  }:0 1 _1   2.5
>           bin  =.  #: @: (a.&i.) @: (3!:1"1) @: (,. :. {.)
>           ] Z =. ~:/ &.: bin i_1
>       0
>           %Z
>       __
> 
> Basically it finds the difference in the binary representations of 
> 1  and  _1  and applies that patch to  0  (all numbers are 
> floating point).
>           
> So, if ever Roger "fixes"  %  (such that  0 -:&:(3!:3) 0%_1  ) and 
> any other primitives which can name the beast, J will still have a 
> negative zero (because the IEEE floating point standard calls for it).
> 
> -Dan
> 
>   (A)  http://www.jsoftware.com/jwiki/Guides/Constants#simplest   
>         (2nd bullet in notes)
>        http://www.jsoftware.com/pipermail/general/2004-
> July/017905.html    (3rd long paragraph, begins with "J constants 
> are created")
> 
>   (B)  http://www.jsoftware.com/pipermail/programming/2005-
> December/000540.html
>   (C)  http://www.jsoftware.com/pipermail/programming/2005-
> December/000545.html
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to