Board index » Visual Studio » Implementing Log

Implementing Log

Visual Studio156
In C++, what is the correct syntax to implement the expression of "10 log e"?


-
 

Re:Implementing Log

On Tue, 22 Nov 2005 21:14:01 -0800, "Charles Tam"

<CharlesTam@discussions.microsoft.com>wrote:



Quote
In C++, what is the correct syntax to implement the expression of "10 log e"?



It's not clear what you mean. If you mean "ten times the natural logarithm

of e" then a good way to implement it would be



10



If you mean "ten times the common logarithm of e" then ...



10 * log10(exp(1))



If you want something else, be clearer.

--

- Vince

-

Re:Implementing Log

"Charles Tam" <CharlesTam@discussions.microsoft.com>wrote:

Quote


In C++, what is the correct syntax to implement the expression of "10 log e"?



What do you mean by that? Do you mean the log of 10 in base e? That is,

the natural log of 10? That's actually defined as a constant in math.h,

M_LN10.



If you want to know how to take the natural log of an arbitrary floating

point value, use log(x).

--

- Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

-

Re:Implementing Log

I meant "ten times the common logarithm of e", thanks.



"Vincent Fatica" wrote:



Quote
On Tue, 22 Nov 2005 21:14:01 -0800, "Charles Tam"

<CharlesTam@discussions.microsoft.com>wrote:



>In C++, what is the correct syntax to implement the expression of "10 log e"?



It's not clear what you mean. If you mean "ten times the natural logarithm

of e" then a good way to implement it would be



10



If you mean "ten times the common logarithm of e" then ...



10 * log10(exp(1))



If you want something else, be clearer.

--

- Vince



-

Re:Implementing Log

Charles Tam <CharlesTam@discussions.microsoft.com>wrote:

Quote
I meant "ten times the common logarithm of e", thanks.



10 * M_LOG10E



--

With best wishes,

Igor Tandetnik



With sufficient thrust, pigs fly just fine. However, this is not

necessarily a good idea. It is hard to be sure where they are going to

land, and it could be dangerous sitting under them as they fly

overhead. -- RFC 1925





-