Float vs Double
Cochrane Wrote:If you do
the finished program will load the number as a double and then convert it to a float, which is slower thanCode:
float foo = 2.0
where the number will be loaded directly as float.Code:
float foo = 2.0f
Well in cases like that, as long as you compile with optimizations on (i.e. release mode), any compiler worth its salt will precompute known constant conversions as far as possible at compile time.
And things are a bit complicated in the float/double world, this link explains things better than I can:
http://cpptips.hyperformix.com/cpptips/flt_dbl
| Messages In This Thread |
|
Float vs Double - bwalters - Dec 10, 2005, 10:04 AM
Float vs Double - Cochrane - Dec 10, 2005, 10:38 AM
Float vs Double - bwalters - Dec 10, 2005, 10:52 AM
Float vs Double - zKing - Dec 10, 2005 12:18 PM
Float vs Double - OneSadCookie - Dec 10, 2005, 03:56 PM
Float vs Double - zKing - Dec 10, 2005, 04:29 PM
Float vs Double - jfaller - Dec 12, 2005, 10:58 AM
Float vs Double - Zekaric - Dec 12, 2005, 11:18 AM
Float vs Double - zKing - Dec 12, 2005, 11:40 AM
Float vs Double - Oblivion - Dec 12, 2005, 03:58 PM
Float vs Double - Najdorf - Dec 19, 2005, 11:08 AM
Float vs Double - ThemsAllTook - Dec 19, 2005, 12:40 PM
Float vs Double - Najdorf - Dec 19, 2005, 03:05 PM
Float vs Double - Fenris - Dec 19, 2005, 04:15 PM
Float vs Double - jfaller - Dec 20, 2005, 07:07 AM
Float vs Double - Fenris - Dec 20, 2005, 09:21 AM
Float vs Double - Zekaric - Dec 20, 2005, 10:25 AM
Float vs Double - Fenris - Dec 20, 2005, 12:29 PM
Float vs Double - OneSadCookie - Dec 20, 2005, 12:39 PM
Float vs Double - skyhawk - Dec 20, 2005, 01:10 PM
Float vs Double - Zekaric - Dec 20, 2005, 01:45 PM
Float vs Double - Fenris - Dec 20, 2005, 05:40 PM
Float vs Double - Zekaric - Dec 20, 2005, 06:10 PM
Float vs Double - jfaller - Jan 3, 2006, 02:44 PM
Float vs Double - DoG - Jan 3, 2006, 03:49 PM
|
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| float value changes when passed to function | kendric | 5 | 3,127 |
Nov 15, 2009 01:57 PM Last Post: kendric |
|

