Challenge type: Shortcode
Description: The challenge is to make an alias that will return the log function of the given number to the base X. For an explanation of how logx works, view this: http://en.wikipedia.org/wiki/Logarithm
Restrictions:
No Sockets
No Dlls
No Regex
No Coms
No abuse of the testing script.
alias name shall be logx
Examples:
$logx(2,8) should return 3 because 2^3 = 8
$logx(10,100) should return 2 because 10^2=100
$logx(64,8) should return 0.5 or 1/2 because 64^0.5 = 8
$logx(16,0.0625) should return -1 because 16^-1 = 0.0625
$logx(-1,4) should return Non-Real Error as it is an invalid equation
$logx(4,-1) should return Non-Real Error as it is an invalid equation
$logx(0,12) should return Non-Real Error as it is an invalid equation
$logx(12,0) should return Non-Real Error as it is an invalid equation
Test Alias:
alias logxtest {
var %a 2,10,64,16,8,-2,2,5.5,0,20, %b 8,100,8,0.0625,-1,16,1,5.5,1,0, %c 3,2,0.5,-1,Non-Real Error,Non-Real Error,0,1,Non-Real Error,Non-Real Error, %d 1, %errors
while (%d < 11) {
if ($logx($gettok(%a,%d,44),$gettok(%b,%d,44)) != $gettok(%c,%d,44)) {
inc %errors
echo -a Error in test %d $+ : $+($,logx,$chr(40),$gettok(%a,%d,44),$chr(44),$gettok(%b,%d,44),$chr(41)) should return $gettok(%c,%d,44) $+ .
}
inc %d
}
echo -a Test complete with %errors errors.
}
Closing: Will end a week after this post was made. All entries shall be pm'd to Cameron on forums.