વિભાગ:Math/doc: આવૃત્તિઓ વચ્ચેનો તફાવત
Content deleted Content added
KartikMistry (ચર્ચા | યોગદાન) નાનું en:Module:Math/doc માંથી આયાત કરેલ ૫૩ પુનરાવર્તનો |
નાનું Bot: Replace deprecated <source> tag and "enclose" parameter [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html] |
||
લીટી ૭:
To use the module from normal wiki pages, no special preparation is needed. If you are using the module from another Lua module, first you need to load it, like this:
<
local mm = require('Module:Math')
</syntaxhighlight>
(The <code>mm</code> variable stands for '''M'''odule '''M'''ath; you can choose something more descriptive if you prefer.)
લીટી ૨૨:
{{#invoke:math|random|''min_value''|''max_value''}}
<
mm._random()
mm._random(max_value)
mm._random(min_value, max_value)
</syntaxhighlight>
Generates a random number.
લીટી ૪૦:
{{#invoke:math|order|''n''}}
<
mm._order(n)
</syntaxhighlight>
Determines the [[order of magnitude]] of a number.
લીટી ૫૧:
{{#invoke:math|precision|x=''n''}}
<
mm._precision(number_string)
</syntaxhighlight>
Detemines the precision of a number. For example, for "4" it will return "0", for "4.567" it will return "3", and for "100" it will return "-2".
લીટી ૬૩:
{{#invoke:math|max|''v1''|''v2''|''v3''|...}}
<
mm._max(v1, v2, v3, ...)
</syntaxhighlight>
Returns the maximum value from the values specified. Values that cannot be converted to numbers are ignored.
લીટી ૭૩:
{{#invoke:math|median|''v1''|''v2''|''v3''|...}}
<
mm._median(v1, v2, v3, ...)
</syntaxhighlight>
Returns the [[median]] value from the values specified. Values that cannot be converted to numbers are ignored.
લીટી ૮૩:
{{#invoke:math|min|''v1''|''v2''|''v3''|...}}
<
mm._min(v1, v2, v3, ...)
</syntaxhighlight>
Returns the minimum value from the values specified. Values that cannot be converted to numbers are ignored.
લીટી ૯૩:
{{#invoke:math|sum|''v1''|''v2''|''v3''|...}}
<
mm._sum(v1, v2, v3, ...)
</syntaxhighlight>
Returns the sum of the values specified. Values that cannot be converted to numbers are ignored.
લીટી ૧૦૩:
{{#invoke:math|average|''v1''|''v2''|''v3''|...}}
<
mm._average(v1, v2, v3, ...)
</syntaxhighlight>
Returns the average of the values specified. (More precisely, the value returned is the [[Mean#Arithmetic mean (AM)|arithmetic mean]].) Values that cannot be converted to numbers are ignored.
લીટી ૧૧૪:
{{#invoke:math|round|value=''value''|precision=''precision''}}
<
mm._round(value, precision)
</syntaxhighlight>
[[Rounding|Rounds]] a number to the specified precision.
લીટી ૧૨૬:
{{#invoke:math | log10 | ''x''}}
<
mm._log10(x)
</syntaxhighlight>
Returns <code>log<sub>10</sub>(''x'')</code>, the [[logarithm]] of ''x'' using base 10.
લીટી ૧૩૬:
{{#invoke:math|mod|''x''|''y''}}
<
mm._mod(x, y)
</syntaxhighlight>
Gets <code>''x''</code> [[Modulo operation|modulo]] <code>''y''</code>, or the remainder after <code>''x''</code> has been divided by <code>''y''</code>. This is accurate for integers up to 2<sup>53</sup>; for larger integers Lua's modulo operator may return an erroneous value. This function deals with this problem by returning <code>0</code> if the modulo given by Lua's modulo operator is less than 0 or greater than <code>''y''</code>.
લીટી ૧૪૬:
{{#invoke:math|gcd|''v1''|''v2''|...}}
<
mm._gcd(v1, v2, ...)
</syntaxhighlight>
Finds the [[greatest common divisor]] of the values specified. Values that cannot be converted to numbers are ignored.
લીટી ૧૫૬:
{{#invoke:math|precision_format|''value_string''|''precision''}}
<
mm._precision_format(value_string, precision)
</syntaxhighlight>
Rounds a number to the specified precision and formats according to rules originally used for {{tl|Rnd}}. Output is a string.
લીટી ૧૭૦:
== cleanNumber ==
<
local number, number_string = mm._cleanNumber(number_string)
</syntaxhighlight>
A helper function that can be called from other Lua modules, but not from #invoke. This takes a string or a number value as input, and if the value can be converted to a number, cleanNumber returns the number and the number string. If the value cannot be converted to a number, cleanNumber returns <code>nil, nil</code>.
|