For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > Implementing Log









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Implementing Log
Charles Tam

2005-11-23, 3:59 am

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

2005-11-23, 3:59 am

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
Tim Roberts

2005-11-23, 3:59 am

"Charles Tam" <CharlesTam@discussions.microsoft.com> wrote:
>
>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.
Charles Tam

2005-11-23, 7:04 pm

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

"Vincent Fatica" wrote:

> On Tue, 22 Nov 2005 21:14:01 -0800, "Charles Tam"
> <CharlesTam@discussions.microsoft.com> wrote:
>
>
> 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
>

Igor Tandetnik

2005-11-23, 7:04 pm

Charles Tam <CharlesTam@discussions.microsoft.com> wrote:
> 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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com