t=: ('3fe',13$'f'),('3ff',13$'0'),:'3ff',(12$'0'),'1'
   t
3fefffffffffffff
3ff0000000000000
3ff0000000000001
   ":!.18 cons"1 t
0.99999999999999989 1 1.0000000000000002
   ":!.18 ] 1 - cons"1 t
1.1102230246251565e_16 0 _2.2204460492503131e_16



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Tuesday, April 10, 2007 8:31 am
Subject: Re: [Jprogramming] limit constants

> I usually solve such problems by working with the
> hex representation.  Thus:
> 
>   unhex=: 3!:2
>   hex  =: 2&(3!:3)
>   cons =: unhex @ ((}: hex 0.5)&,)
>   
>   ":!.18 cons (15$'0'),'1'  NB. just larger than 0
> 4.9406564584124654e_324
>   ":!.18 cons '3fe',13$'f'  NB. just smaller than 1
> 0.99999999999999989
>   ":!.18 cons '7fe',13$'f'  NB. largest finite positive
> 1.7976931348623157e308
> 
> Regarding the middle one, the following expressions
> show that the answer is correct:
> 
>   ":!.18 ] 1 - cons '3fe',13$'f'
> 1.1102230246251565e_16
>   ":!.18 ] 1 - cons '3ff',13$'0'
> 0
> 
> 
> 
> ----- Original Message -----
> From: bill lam <[EMAIL PROTECTED]>
> Date: Tuesday, April 10, 2007 3:05 am
> Subject: [Jprogramming] limit constants
> 
> > Hi all,
> > 
> > With respect to J's IEEE double, how to get the numbers that
> > a. just larger than 0 (smallest positive number)
> > b. just smaller than 1
> > c. largest positive number
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to