How to implement double pow(double x , double y)
-
I have to impelement my own double pow(double x , double y) I cannot use of math library any ideas Ctrl+Alt+Del
-
I have to impelement my own double pow(double x , double y) I cannot use of math library any ideas Ctrl+Alt+Del
it helps if you understand what POWER means... in primary school, we learnt that 2^5 = 2*2*2*2*2 so x^y = x1*x2*x3*x4*...*xj where j=y you don't need any maths libraries... i hope this helps with you homework... Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au
-
it helps if you understand what POWER means... in primary school, we learnt that 2^5 = 2*2*2*2*2 so x^y = x1*x2*x3*x4*...*xj where j=y you don't need any maths libraries... i hope this helps with you homework... Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au
-
In high school, we learned that you can raise numbers to non-integer powers. Although your 'algorithm' would be applicable if the request was for double pow(double x, int y), things become more complicated for double y, typically involving logarithms.
yup... sounds reasonable... it's been a VERY long time since i was at either primary school or high school, but your response sounds reasonable... either way, this sounds like a 'homework' question, and i think our friend needs to do their homework by looking up the alorithms either on the net, or in their maths book... cheers nik Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au
-
it helps if you understand what POWER means... in primary school, we learnt that 2^5 = 2*2*2*2*2 so x^y = x1*x2*x3*x4*...*xj where j=y you don't need any maths libraries... i hope this helps with you homework... Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au
Mr. Nik, How with your primary school maths, can you calculate Pow(1.5, 2.3) I myself don't know the answer. But I would give a friendly advice - Give a thought before commeting and telling what is taught in primary schools. Thanks Ruchi
-
I have to impelement my own double pow(double x , double y) I cannot use of math library any ideas Ctrl+Alt+Del
public double Pow(double a, double b) { double temp = 0, final = 0; temp = b*Math.Log(a); final = Math.Exp(temp); return final; } Hope this helps Thanks Ruchi
-
Mr. Nik, How with your primary school maths, can you calculate Pow(1.5, 2.3) I myself don't know the answer. But I would give a friendly advice - Give a thought before commeting and telling what is taught in primary schools. Thanks Ruchi
ruchi, if you had read my previous response to janovetz, you would have realised i had already conceded that point... i would also like to provide some friendly advice... read *all* the thread before providing friendly advice... cheers nik Nik Vogiatzis PhD Candidate: University of South Australia +++++++++++++++++++++++++++ Developing new generation Traffic Micro-simulation Tools for Traffic Engineers em: nikolaos.vogiatzis@unisa.edu.au