Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched?

Please consider the following:

data={123.,56.,45.};
Head/@data
(*result: {Real,Real,Real}*)

How do I change the numbers in data into integers, so:

dataConv=MyFunction/@data;
Head/@dataConv
(*result: {Integer,Integer,Integer}*)

EDIT

Also interesting could be to change "real" reals like {12.3,10.555} into integers by returning only the numbers before the decimal separator (*result: {12,10}*).

share|improve this question

marked as duplicate by R. M., Sjoerd C. de Vries Sep 21 '12 at 14:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Why not Round[data] and Floor[data] ? – b.gatessucks Sep 21 '12 at 13:48

Simply ...

dataConv = IntegerPart /@ data;
Head /@ dataConv

{Integer, Integer, Integer}

But beware of machine precision:

x = 6250*0.292
IntegerPart[%]

1825.

1824

May be better to use Round as suggested.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.