Original Post
Has anyone got articles on the speed difference between float and double and what you can use which one best for.
Tnx!
void floatFunc()
{
float x = 1;
for (int i = 0; i < 200000000; i++)
{
x *= ((x + 1.0f) / 2.0f);
}
std::cout << x << ''\n'';
}
void doubleFunc()
{
double x = 1;
for (int i = 0; i < 200000000; i++)
{
x *= ((x + 1.0) / 2.0);
}
std::cout << x << ''\n'';
}
% cumulative self self total
time seconds seconds calls s/call s/call name
49.83 3.01 3.01 1 3.01 3.01 floatFunc()
49.83 6.02 3.01 1 3.01 3.01 doubleFunc()
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more