Class Index | File Index

## Classes

- _global_
- M
- M.ActionSheetDialogView
- M.AlertDialogView
- M.Application
- M.Base64
- M.ButtonGroupView
- M.ButtonView
- M.ConfirmDialogView
- M.ContainerView
- M.Controller
- M.Cypher
- M.DataProvider
- M.Date
- M.DateValidator
- M.EmailValidator
- M.Environment
- M.EventDispatcher
- M.FormView
- M.GridView
- M.I18N
- M.ImageView
- M.LabelView
- M.ListItemView
- M.ListView
- M.LoaderView
- M.LocalStorageProvider
- M.Logger
- M.Math
- M.Model
- M.ModelAttribute
- M.ModelRegistry
- M.NotMinusValidator
- M.NumberValidator
- M.Object
- M.Observable
- M.PageView
- M.PhoneValidator
- M.PresenceValidator
- M.RecordManager
- M.RemoteStorageProvider
- M.Request
- M.ScrollView
- M.SearchBarView
- M.SelectionListItemView
- M.SelectionListView
- M.SHA256
- M.TabBarItemView
- M.TabBarView
- M.TextFieldView
- M.ToggleView
- M.ToolbarView
- M.UrlValidator
- M.Validator
- M.View
- M.ViewManager
- M.WebSqlProvider

# Class M.Math

Extends M.Object.
This prototype defines methods for simpler handling of mathematical operations.
Defined in: math.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| M.Math()

Field Summary
Field Attributes | Field Name and Description
--- | ---
| type The type of this object.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| pow(base, exponent) This method returns the value of the base to the power of the exponent.
| random(min, max) The method returns a random number within the range given by the min property and the max property, including the min and max value.
| round(input, type, type) The method returns rounded version of the given input number.

Methods borrowed from class M.Object:
  bindToCaller, create, destroy, extend, get, include, set

Class Detail
M.Math()
Field Detail
{String} type
The type of this object.
Method Detail
{Number} pow(base, exponent)
This method returns the value of the base to the power of the exponent. So e.g. pow(2, 3) would return '2 to the power of 3' --> 8.

Parameters:
base
  {Number} The base.
exponent
  {Number} The exponent.

Returns:
  {Number} The result of the operation.

{Number} random(min, max)
The method returns a random number within the range given by the min property and the max property, including the min and max value. A test with 100.000 iterations for random(1, 3) created the following distribution: - 1: 33.2% - 2: 33.2% - 3: 33.6%

Parameters:
min
  {Number} The minimal value.
max
  {Number} The maximal value.

Returns:
  {Number} The result of the operation.

{Number} round(input, type, type)
The method returns rounded version of the given input number. There are three types of rounding available: - M.FLOOR: Returns the next lower integer, so 2.1 and 2.9 both would return 2. - M.CEIL: Returns the next higher integer, so 2.1 and 2.9 both would return 3. - M.ROUND: Returns the nearest integer, so 2.1 would return 2 and 2.9 would return 3. With the optional third parameter 'decimals', you can specify the number of decimal digits to be returned. For example round(1.2345, M.FLOOR, 3) would return 1.234. The default for this parameter is 0.

Parameters:
input
  {Number} The input value.
type
  {String} The type of rounding.
type
  {Number} The number of decimals (only available for M.ROUND).

Returns:
  {Number} The result of the operation.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 08 2010 15:07:32 GMT+0100 (MEZ)