#include "MusimatTutorial.h"Go to the source code of this file.
Functions | |
| MusimatTutorialSection (B0127) | |
| MusimatTutorialSection | ( | B0127 | ) |
Definition at line 2 of file B0127.cpp.
00002 { 00003 Print("*** B.1.27 Other Built-in Functions ***"); 00004 /***************************************************************************** 00005 00006 B.1.27 Other Built-in Functions 00007 00008 Musimat includes standard mathematical functions such as Sqrt(x). There are trigono- 00009 metric functions such as Sin(x), Cos(x), and Tan(x). Arguments to trigonometric functions 00010 are in real radian values. Speaking of radian measure, here’s an interesting way to compute Pi to 00011 the machine precision of your computer: 00012 *****************************************************************************/ 00013 00014 Const Real Pi = Atan(1.0) * 4.0; // arctangent of 1 times 4 equals Pi 00015 00016 /***************************************************************************** 00017 The function Abs(x) returns the absolute value of its argument. It works for either Real or 00018 Integer expressions. For instance, both of the following statements will print True: 00019 *****************************************************************************/ 00020 00021 If (Abs(-5) == Abs(5)) // Integer Abs( ) 00022 Print(True); 00023 Else 00024 Print(False); 00025 00026 If (Abs(-5.0) == Abs(5.0)) // Real Abs( ) 00027 Print(True); 00028 Else 00029 Print(False); 00030 00031 /***************************************************************************** 00032 With no arguments, the built-in function Random() returns a real random value between 0.0 and 00033 1.0, but if Random() is given arguments specifying Real lower and upper bounds, it returns a 00034 Real random value between those boundaries. For example, 00035 *****************************************************************************/ 00036 00037 Real x = Random(0.0, 11.0); 00038 00039 /***************************************************************************** 00040 returns a random Real value in the range 0.0 <= x < 11.0. Note the range is from 0.0 to almost 11.0. 00041 00042 If Random() is given arguments specifying Integer lower and upper bounds, it returns an 00043 Integer random value between those boundaries. For example, 00044 *****************************************************************************/ 00045 00046 Integer y = Random(0, 11); 00047 00048 /***************************************************************************** 00049 returns a random Integer value in the range [0..11]. Note the range is inclusive from 0 to 11. 00050 00051 *****************************************************************************/ 00052 }}
1.4.7