Well, perhaps you meant:
   g=:([: <. 0.5 + ]) -. >. -:"0 [: >. 1r2 + ]

But
    g 1.25*_1 1

_1
and

   f 1.25*_1 1

_1
whereas

   g (1.25e10+1r2)*_1 1

_12500000000 12500000001
and

   f (1.25e10+1r2)*_1 1

_12500000000 12500000001


Ranks:
   g b. 0

_ _ _


    f b. 0

_ _ _



???
Mike

On 15/01/2016 06:27, Linda A Alvord wrote:
Is there a way to make a verb use extended precision?

     f=: 13 :'(<.0.5+y)-.(>.y)-:"0>.0.5+y'
    f
([: <. 0.5 + ]) -. >. -:"0 [: >. 0.5 + ]
g=:([: <. 0.5 + ]) -. >. -:"0 [: >. 0.5x + ]
|ill-formed number: scriptd
|[-6] c:\users\user\j804-user\temp\36.ijs

Linda
-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of Linda A Alvord
Sent: Friday, January 15, 2016 12:44 AM
To: [email protected]
Subject: Re: [Jprogramming] Round to nearest integer: harder than it seems

When does this fail?

    ]N=:100*?4 5$0
97.1379 4.66292 33.0109   1.346 22.0004
60.0044 27.5797 96.3872 87.1029 67.5376
61.6793 57.1841 70.5857 62.2286 18.8883
58.1309  92.616 15.5295 76.6284 87.4544
    f=: 13 :'(<.0.5+y)-.(>.y)-:"0>.0.5+y'
    f N
97  5 33  1 22
60 28 96 87 68
62 57 71 62 19
58 93 16 77 87

Linda


[NB. I've snipped history - Mike]

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to