logarithm problem

Find quick help here to get you started with Hollywood
Post Reply
tolkien
Posts: 190
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

logarithm problem

Post by tolkien »

Hello.

I´m trying to do a simply program to sum dB.

I have created a function that read two dB and operate with them
The problem is that the LOG give me problems. It always return 1 tu dBtotal.

And the most simple LOG operation ( Log(c, 10) ) give the error "Too many arguments for this function!"
I´m new in Hollywood and the last time I coded something was a lot of years ago!


Hope for a tip!

Thanks!



Function p_Suma(dx1, dx2)

a = (10^(dx1/10))
b = (10^(dx2/10))
c = a + b

dBtotal = Log(c) /* HERE */
NPrint ("La suma es:",dBtotal)
EndFunction
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: logarithm problem

Post by airsoftsoftwair »

This is a known bug in Hollywood. It will be fixed in the next version :)
tolkien
Posts: 190
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

Re: logarithm problem

Post by tolkien »

:cry: Hope do you fix soon! I really thought was becoming mad! :)


Thanks!
jalih
Posts: 276
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: logarithm problem

Post by jalih »

tolkien wrote::cry: Hope do you fix soon! I really thought was becoming mad! :)
Ld() function at least seems to work in Hollywood and writing your own Log10() function based on that is quite easy...

If I recall correctly, a little bit of math gives us: log10(x) = log2(x) / log2(10)

So our function becomes:

Code: Select all

Function p_log10(n)

	Local result = Ld(n)/Ld(10)

	Return(result)

EndFunction
tolkien
Posts: 190
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

Re: logarithm problem

Post by tolkien »

Hey! Thanks jalih! I´ll try it later. But a fix would be better! ;)
tolkien
Posts: 190
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

Re: logarithm problem

Post by tolkien »

Siii! Tried and working! Thanks so much!
Post Reply