How to get the actual value?
-
Hi I am a student.When I do my homework,i encounter a problem.I can not get the actual value in VisualC++. The question is how to get 95.123 raised by 12. Maybe I haven't explained my mean.Sorry about my poor English! Thanx first! -- modified at 1:49 Thursday 27th October, 2005
-
Hi I am a student.When I do my homework,i encounter a problem.I can not get the actual value in VisualC++. The question is how to get 95.123 raised by 12. Maybe I haven't explained my mean.Sorry about my poor English! Thanx first! -- modified at 1:49 Thursday 27th October, 2005
:doh: :confused: What are you speaking about ?? What means " 95.123 's 12th power " ?? And what are you trying to do exactly and what is the exact problem encoutered ? Try to be more specific.
-
Hi I am a student.When I do my homework,i encounter a problem.I can not get the actual value in VisualC++. The question is how to get 95.123 raised by 12. Maybe I haven't explained my mean.Sorry about my poor English! Thanx first! -- modified at 1:49 Thursday 27th October, 2005
ShiningStarPxx wrote:
The question is how to get 95.123 's 12th power.
Do you mean 95.12312 instead? Even using an
unsigned long double
, you'd get something like 5.4881562051773182e+023. You might could get a bit more precision by using the DECIMAL data type.
"Take only what you need and leave the land as you found it." - Native American Proverb
-
ShiningStarPxx wrote:
The question is how to get 95.123 's 12th power.
Do you mean 95.12312 instead? Even using an
unsigned long double
, you'd get something like 5.4881562051773182e+023. You might could get a bit more precision by using the DECIMAL data type.
"Take only what you need and leave the land as you found it." - Native American Proverb
Thank you first! But i can not catch your means.Would you like to explain it with a sample code.
-
:doh: :confused: What are you speaking about ?? What means " 95.123 's 12th power " ?? And what are you trying to do exactly and what is the exact problem encoutered ? Try to be more specific.
The question is how to get 95.123 raised by 12. Maybe I haven't explained my means.Sorry about my poor English!
-
The question is how to get 95.123 raised by 12. Maybe I haven't explained my means.Sorry about my poor English!
You can use the
double pow(double,double);
for that purpose. Don't forget to include math.h at the top of your file ;). -
Thank you first! But i can not catch your means.Would you like to explain it with a sample code.
-
#include #include void main( void ) { double x = 2.0, y = 3.0, z; z = pow( x, y ); printf( "%.1f to the power of %.1f is %.1f\n", x, y, z ); } Output 2.0 to the power of 3.0 is 8.0
-
Thank you first! But i can not catch your means.Would you like to explain it with a sample code.
On paper, 95.12312 is 548815620517731830194541.89902534. However, that number is too big to fit in any type, including an
unsigned long double
. It would only give you something like 5.4881562051773182e+023 (which equates to 548815620517731820000000.0). Notice the loss of precision. ADECIMAL
type may get you a bit more precision.
"Take only what you need and leave the land as you found it." - Native American Proverb