Blockland Forums > Modification Help

[CHALLENGE] Rosetta Code - "Tasks not implemented in torquescript"

Pages: << < (7/12) > >>

Destiny/Zack0Wack0:


--- Quote from: Port on June 18, 2012, 03:59:51 AM ---"Real constants and functions"

[*] E: $e = 2.71828
[*] Pi: $pi = 3.14159 (not always defined)
[*] Natural Logarithm: mLow(x) / mLog($e)
[*] Base 10 Logarithm: mLog(x)
[*] Exponential: mPow($e, x)
[*] Exponentiation: mPow(x, y)
[*] Exponentiation Modulo: mPow(x, y) % z

--- End quote ---

--- Quote from: Port on June 18, 2012, 04:02:45 AM ---"Assertion":


--- Code: ---if ( !expression )
{
    // possibly display an error
    // error( x );
   
    return;
    // instead, possibly return a value to parent function to abort as well
    // return x;
}

--- End code ---

--- End quote ---
This doesn't meet the definition of the assertion on the page.

Port:


--- Quote from: Destiny/Zack0Wack0 on June 18, 2012, 05:12:32 AM ---This doesn't meet the definition of the assertion on the page.

--- End quote ---

Replace expresion with %x == 42 and it does.

Destiny/Zack0Wack0:


--- Quote ---Assertions are a way of breaking out of code when there is an error or an unexpected input. Some languages throw exceptions and some treat it as a break point.
--- End quote ---
It has to manually break out of code when there is an unexpected error. It's an assertion in English semantics, but not in the traditional way that page is describing.

Port:


--- Quote from: Destiny/Zack0Wack0 on June 18, 2012, 05:12:32 AM ---E: $e = 2.71828
Natural Logarithm: mLow(x) / mLog($e)
Exponential: mPow($e, x)
Exponentiation Modulo: mPow(x, y) % z

--- End quote ---

These aren't natural.

Treynolds416:

Guys, the default mLog() is the natural log, not the base 10 log. You still have to do change of bases though.

Pages: << < (7/12) > >>

Go to full version