Re: doubles and floats
From: Dennis Myrén (dennis_at_oslokb.no)
Date: 09/28/04
- Next message: Morten Wennevik: "Re: doubles and floats"
- Previous message: Shiva: "Re: doubles and floats"
- In reply to: Dennis Myrén: "Re: doubles and floats"
- Next in thread: Shiva: "Re: doubles and floats"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Sep 2004 11:32:47 +0200
Sorry;
"It requires an implicit conversion"
should be
"It requires an explicit conversion"
-- Regards, Dennis JD Myrén Oslo Kodebureau "Dennis Myrén" <dennis@oslokb.no> wrote in message news:7aa6d.9441$WW4.150194@news4.e.nsc.no... > It requires an implicit conversion because double to float conversion is > potentially unsafe > and might throw an exception. > In your case, you may change > fltPCRateStd = fltPCRateStd * 1.175; > into > fltPCRateStd = fltPCRateStd * 1.175F; > to explicitly specify that the number 1.175 is of single precision. > Floating point numbers defaults to be double precisioned. > > -- > Regards, > Dennis JD Myrén > Oslo Kodebureau > "Mike P" <mrp@telcoelectronics.co.uk> wrote in message > news:uWspasTpEHA.324@TK2MSFTNGP11.phx.gbl... >> Why does this cause the error 'cannot implicitly convert type 'double' >> to 'float'? Can you not multiply doubles by floats without converting >> them all to the same datatype? >> >> fltPCRateStd = fltPCRateStd * 1.175; >> >> >> Regards, >> >> Mike >> >> >> >> *** Sent via Developersdex http://www.developersdex.com *** >> Don't just participate in USENET...get rewarded for it! > >
- Next message: Morten Wennevik: "Re: doubles and floats"
- Previous message: Shiva: "Re: doubles and floats"
- In reply to: Dennis Myrén: "Re: doubles and floats"
- Next in thread: Shiva: "Re: doubles and floats"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|