• Forum
  • Lounge
  • Why is double the default floating point

 
Why is double the default floating point type?

Like the question askes, does anyone have any idea why double was chosen as the default floating point decimal? By default, I mean that when you declare 1.0, it's a double, but to simulate a smaller memory variable, you need to type the f, 1.0f. int makes sense to be the default, but I figure float would as well.
Last edited on
Because most ALUs take the same amount of time to operate on doubles as on floats. Even further, some of them process floats slower than doubles, because additional conversions from float to double and back are required. On the other hand, floats might be faster if compiler vectorizes code to SSE - because more floats fit into registers. However, when the C/C++ specs were created, SSE was not yet there.
Last edited on
Topic archived. No new replies allowed.