# Return to Answer

 2 added 517 characters in body edited Jun 19 '17 at 20:23 Alexey Popkov 40k44 gold badges113113 silver badges274274 bronze badges Posting ilian's comment as an answer, That is intended behavior. When operating on a packed array, Clip returns a packed array of the same type. – ilian Checking: lst = RandomReal[{-1, 1}, {10}]; lst2 = RandomInteger[2, 20]; Clip[lst, {0, 0}, {0, 1}] Clip[lst2, {0, 0}, {0, 1}] Clip[DeveloperFromPackedArray@lst, {0, 0}, {0, 1}]  {1., 0., 0., 1., 1., 1., 0., 1., 1., 0.} {1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1} {1, 0, 0, 1, 1, 1, 0, 1, 1, 0}    But Clip[RandomInteger[2, 10], {0., 0.}, {0., 1.}] returns a packed array of reals: Clip[lst2, {0., 0.}, {0., 1.}] % // DeveloperPackedArrayQ  {1., 0., 0., 0., 1., 0., 1., 1., 0., 1., 1., 0., 0., 1., 0., 1., 1., 0., 0., 1.} True  Yes, my previous comment was not precise enough. It also matters whether the ranges can be packed and into what type. For example, Clip[RandomInteger[2, 10], {0., 0.}, {0., 1}] and Clip[RandomReal[2, 10], {0., 0.}, {0., Infinity}] do not return a packed result. Posting ilian's comment as an answer, That is intended behavior. When operating on a packed array, Clip returns a packed array of the same type. – ilian Checking: lst = RandomReal[{-1, 1}, {10}]; lst2 = RandomInteger[2, 20]; Clip[lst, {0, 0}, {0, 1}] Clip[lst2, {0, 0}, {0, 1}] Clip[DeveloperFromPackedArray@lst, {0, 0}, {0, 1}]  {1., 0., 0., 1., 1., 1., 0., 1., 1., 0.} {1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1} {1, 0, 0, 1, 1, 1, 0, 1, 1, 0}  But Clip[lst2, {0., 0.}, {0., 1.}] % // DeveloperPackedArrayQ  {1., 0., 0., 0., 1., 0., 1., 1., 0., 1., 1., 0., 0., 1., 0., 1., 1., 0., 0., 1.} True  Posting ilian's comment as an answer, That is intended behavior. When operating on a packed array, Clip returns a packed array of the same type. Checking: lst = RandomReal[{-1, 1}, {10}]; lst2 = RandomInteger[2, 20]; Clip[lst, {0, 0}, {0, 1}] Clip[lst2, {0, 0}, {0, 1}] Clip[DeveloperFromPackedArray@lst, {0, 0}, {0, 1}]  {1., 0., 0., 1., 1., 1., 0., 1., 1., 0.} {1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1} {1, 0, 0, 1, 1, 1, 0, 1, 1, 0}    But Clip[RandomInteger[2, 10], {0., 0.}, {0., 1.}] returns a packed array of reals: Clip[lst2, {0., 0.}, {0., 1.}] % // DeveloperPackedArrayQ  {1., 0., 0., 0., 1., 0., 1., 1., 0., 1., 1., 0., 0., 1., 0., 1., 1., 0., 0., 1.} True  Yes, my previous comment was not precise enough. It also matters whether the ranges can be packed and into what type. For example, Clip[RandomInteger[2, 10], {0., 0.}, {0., 1}] and Clip[RandomReal[2, 10], {0., 0.}, {0., Infinity}] do not return a packed result. 1 answered Jun 19 '17 at 16:42 Alexey Popkov 40k44 gold badges113113 silver badges274274 bronze badges Posting ilian's comment as an answer, That is intended behavior. When operating on a packed array, Clip returns a packed array of the same type. – ilian Checking: lst = RandomReal[{-1, 1}, {10}]; lst2 = RandomInteger[2, 20]; Clip[lst, {0, 0}, {0, 1}] Clip[lst2, {0, 0}, {0, 1}] Clip[DeveloperFromPackedArray@lst, {0, 0}, {0, 1}]  {1., 0., 0., 1., 1., 1., 0., 1., 1., 0.} {1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1} {1, 0, 0, 1, 1, 1, 0, 1, 1, 0}  But Clip[lst2, {0., 0.}, {0., 1.}] % // DeveloperPackedArrayQ  {1., 0., 0., 0., 1., 0., 1., 1., 0., 1., 1., 0., 0., 1., 0., 1., 1., 0., 0., 1.} True