Re: 12.34f vs (float) 12.34
From: Klaus H. Probst (usenet001_at_vbbox.com)
Date: 02/11/04
- Next message: Klaus H. Probst: "Re: What does the modifier have methid from interface?"
- Previous message: Vladimir Bezugliy: "A C# OOP problem"
- In reply to: Jon Shemitz: "12.34f vs (float) 12.34"
- Next in thread: Jon Shemitz: "Re: 12.34f vs (float) 12.34"
- Reply: Jon Shemitz: "Re: 12.34f vs (float) 12.34"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 11 Feb 2004 00:48:33 -0700
No. The compiler will optimize the cast away assuming it can. It's probably
generating something like this:
private static void Blah()
.locals (float V_0, float V_1)
L_0000: ldc.r4 1.23
L_0001: stloc.0
L_0002: ldc.r4 4.56
L_0003: stloc.1
from this:
static void Blah()
{
float f1 = 1.23F;
float f2 = (float) 4.56;
}
-- ____________________ Klaus H. Probst, MVP http://www.vbbox.com/ "Jon Shemitz" <jon@midnightbeach.com> wrote in message news:4029D05A.2725B798@midnightbeach.com... > Is there a difference between a constant like "12.34f" and "(float) > 12.34"? > > In principle, at least, the latter is a double constant being cast to > a float; while the two both generate actual constants, does the latter > ACTUALLY do a conversion at compile time? That is, are there constants > where > > <constant>f != (float) <constant> > > ? > > -- > > programmer, author http://www.midnightbeach.com > and father http://www.midnightbeach.com/hs
- Next message: Klaus H. Probst: "Re: What does the modifier have methid from interface?"
- Previous message: Vladimir Bezugliy: "A C# OOP problem"
- In reply to: Jon Shemitz: "12.34f vs (float) 12.34"
- Next in thread: Jon Shemitz: "Re: 12.34f vs (float) 12.34"
- Reply: Jon Shemitz: "Re: 12.34f vs (float) 12.34"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|