Re: Clip + Packed Integer Array Machine Precision Results
- To: mathgroup at smc.vnet.net
- Subject: [mg98667] Re: Clip + Packed Integer Array Machine Precision Results
- From: dh <dh at metrohm.com>
- Date: Thu, 16 Apr 2009 04:11:33 -0400 (EDT)
- References: <gs1nqe$7fn$1@smc.vnet.net>
Hi Raffy,
from the manual:
"Clip[x,{min,max},{Subscript[v, min],Subscript[v, max]}]
gives Subscript[v, min] for x<min and Subscript[v, max] for x>max. "
Therefore for xmin<= x <= xmax we simply get x
Further:
"Only machine-sized numbers can be stored in packed form."
Daniel
Raffy wrote:
> This appears to be a bug:
>
> 1: Clip[{1, 2, 3}, {2, 2}, {0, 1/2}] ==> {0, 2, 1/2}
>
> 2: Clip[Developer`ToPackedArray[{1, 2, 3}], {2, 2}, {0, 1/2}] ==>
> {0., 2., 0.5}
>
> 2 should return the exact same as 1, instead it returns a packed
> vector of reals.
>