Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 10-03-2010
Member
 
Join Date: Dec 2009
Posts: 28
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!!!!
Reply With Quote
  #2  
Old 10-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
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);
Reply With Quote
  #3  
Old 10-03-2010
Member
 
Join Date: May 2008
Posts: 2,383
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;
}
Output:
Code:
foo: 1 10 100 200
br: 0 1 2 2.30103
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #4  
Old 10-03-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
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.
Reply With Quote
  #5  
Old 10-03-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 06:10 PM.