|
| |||||||||
| Tags: cpp, functions, header files, library, log10, valarray |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Use of the log10() in C++
I am working in the ABC company as software developer. We can use the C++ language for developing the software. Hence, I can not know about the log10() function of the C++ language. So, I would like to know about the log10() function of the C++ language. I also would like to know about what is the use of the log10() function of the C++ language. Can anyone has the solution for me then reply!!!! |
|
#2
| ||||
| ||||
| Use of the log10() in C++
The lod10() function of the C++ language can be used to calculate the common logarithm of an elements of the valarray. The log10() function can returns an object of the valarray that can containing the common logarithm that is base-10 logarithm of all an elements of y. The log10() function can overloads the cmath's log10 function. The following can be the general form of the log10() function of the C++ language : Code: template<class S> valarray<S> log10 (const valarray<S>& y);
__________________ Grand Theft Auto 4 PC Video Game |
|
#3
| ||||
| ||||
| Re: Use of the log10() in C++
I can suggest you that to carefully go through the following code of lines that can demonstrates you how to use the log10() function in the C++ programming as follows : Code: #include <iostream>
#include <cmath>
#include <vlarray>
using namespace std;
int main ()
{
double vl[] = {1.0, 10.0, 100.0, 200.0};
vlarray<double> foo (vl,4);
vlarray<double> br = log10 (foo);
cout << "foo: ";
for (size_t j=0; j<foo.size(); ++j)
cout << foo[j] << ' ';
cout << endl;
cout << "br: ";
for (size_t j=0; j<br.size(); ++j)
cout << br[j] << ' ';
cout << endl;
return 0;
} Code: foo: 1 10 100 200 br: 0 1 2 2.30103
__________________ The FIFA Manager 2009 PC Game |
|
#4
| ||||
| ||||
| Re: Use of the log10() in C++
The log10() function of the C++ language can returns the value of an object of the valarray with the common logarithmic of an elements of the y. The following can be the parameters of the log10() function in the C++ language : 1. x : This parameter of the log10() function of the valarray containing an elements of a type for that the unary function log10 can be defined. |
|
#5
| ||||
| ||||
| Re: Use of the log10() in C++
The log10() function of the C++ language can returns the base 10 logarithm for num. There can be a domain error if the num can be a negative value and a range of an error if num can be zero. The log10() function of the C++ language can be comes under the valarray header files. See the following example : Code: #include <iostream>
#include <cmath>
using namespace std;
int main ()
{
double prm, rslt;
prm = 1000.0;
rslt = log10(prm);
cout << "log10(" << prm << ") = " << rslt << "\n";
return 0;
}
Output:
log10(1000) = 3 Last edited by Modifier : 10-03-2010 at 04:36 PM. |