HI Vidhya,
as you that both the numbers are double but not float .
you can even check that for integer and short type
why is that when you give a number in short data type range ,the compiler 
always infers it to be of type Int?
One of the reasons is that the compiler plays safe.It avoids any runtime 
problem that might occur.
for that reasons it follows some conventions:
a integer,short,byte by default is assumed to be integer when you haven't 
specified its type.
and ||ly   
for floating point numbers
the default is  double.(if you haven't specified any type)
ex:
scala> val x:float=20.0
<console>:4: error: type mismatch;
 found   : Double(20.0)
 required: float
       val x:float=20.0

 
scala> val y:Float=10.3f
y: Float = 10.3






________________________________
From: "[email protected]" <[email protected]>
To: [email protected]
Sent: Tuesday, 9 June, 2009 7:29:50 PM
Subject: [twincling] SCALAdoubt

Hi all,
  While using the scala interpreter i d a doubt. Why is it that 17.8653 is 
double and 17.2 is also double. Why cant 17.2 be considered as float?

Reg,
Vidhya



------------------------------------


IRC #twincling on irc.freenode.net
Yahoo! Groups Links




      Explore and discover exciting holidays and getaways with Yahoo! India 
Travel http://in.travel.yahoo.com/

[Non-text portions of this message have been removed]

Reply via email to