Skip to main content
gamedev.net
🔒 Locked

Longer variables...

Started by dmf_king Jan 20, 2004 at 3:19 PM 1 replies 300+ views
Original Post
dmf_king
dmf_king
Hi in CCALC, whenever the sqrt of a number is returned it only gives you a limited number of decimal places, then rounds. I am using the variable type float - any solution to give more accurat resultS?
SiCrane
SiCrane
Did you try using double instead?
Sfpiano
Sfpiano
You could try

cout.setf(ios::scientific, ios::floatfield);
cout.precision(x); //x is number of places
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.