Change the base of Log() using second parameter

Propose new features and changes
HakitoJin
Posts: 17
Joined: 02 Oct 2016, 17:20

Change the base of Log() using second parameter

04 Jun 2018, 12:55

Here is what I am currently using:

Code: Select all

LogBase(Number,Base=10)
{
	return Log(Number)/Log(Base)
}
It would be neat if the built-in version could do the same.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Change the base of Log() using second parameter

04 Jul 2018, 18:00

- Great idea, this is what I'm currently using:

Code: Select all

JEE_Log(vNum, vBase:=10)
{
	if (vBase = 10) || (vBase = "")
		return Log(vNum)
	else if (vBase = "e")
		return Ln(vNum)
	else
		return Log(vNum)/Log(vBase)
		;return Ln(vNum)/Ln(vBase)
}
- Do you have much use for this? Which bases? I would use it mainly for base 2 in relation to audio e.g. here:
jeeswg's SoX (Sound eXchange) tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=29234
- I also thought that Floor/Ceil could handle a 2nd parameter, like Round does.
Floor/Ceil able to handle decimal places (cf. Excel's Trunc function) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=41539
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 20 guests