Hello;

Something interesting happens when the exponent is an actual number:

  27*^0.2
32.9779

This suggests:
  27 ^ (^. 2)
Which takes me back to the documentation....

Roger Hui wrote:
Typos:  all comparisons below should be with 0 tolerance,
viz., =!.0 and >:!.0 .



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Saturday, March 1, 2008 22:45
Subject: [Jprogramming] What is interesting about 27*^.2 ?
To: Programming forum <[email protected]>

What is interesting about 27*^.2 ?

   T=: 27*^.2
   T
18.715
   ":!.18 T
18.714973875118524

(spoiler alert.)














What is interesting about T=:27*^.2 ? In IEEE 64-bit floating point calculation, for all y>:T, 1=tanh y (and _1=tanh -y) and T is the smallest number with this property.

   tanh=: (^ - [EMAIL PROTECTED]) % (^ + [EMAIL PROTECTED])

   tanh T
1
   1 - tanh T
0

   hex  =: ([EMAIL PROTECTED]) }. 2&(3!:3)
   unhex=: (3!:2) @ ((}: 2 (3!:3) 0.5)&,) " 1

   hex 1,tanh T
3ff0000000000000
3ff0000000000000

   hex T
4032b708872320e2
t=. unhex (}:,hex T),'1' NB. the next smaller number hex t
4032b708872320e1
   tanh t
1
   1 - tanh t
2.22045e_16
   hex tanh t
3feffffffffffffe
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
------------------------------------------------------------------------
|\/| Randy A MacDonald       | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ |                         | The only real problem with APL is that
BSc(Math) UNBF'83            | it is "still ahead of its time."
Sapere Aude                  |     - Morten Kromberg
Natural Born APL'er          |
-----------------------------------------------------(INTP)----{ gnat }-


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

Reply via email to