ފަންވަތް:Rndfrac/doc: Difference between revisions
Content deleted Content added
Created page with "{{Documentation subpage}} This template rounds to a fraction. It takes two parameters. #the number to be rounded (any real number) #the denominator to be rounded to (positive..." |
އެންމެ ފަހުން ގެނެވުނު ބަދަލު 23:45, 18 އެޕްރީލް 2020 އުނިއިތުރު ގެންނަވާ ކުރީގެ ނުސްހާއަށް ބަދަލުކުރައްވާ Xqbot (ޚިޔާލު ސަފްޙާ | ޙިއްޞާ) m Bot: Replace deprecated <source> tag and "enclose" parameter; cosmetic changes |
||
ފޮޅުވަތް 1:
{{Documentation subpage}}
This template rounds to a fraction.
#the number to be rounded (any real number)
#the denominator to be rounded to (positive integer)
ފޮޅުވަތް 13:
== Code ==
Main template {{tl|rndfrac}}
<
{{#ifexpr: ( {{{2}}} - 1 ) round 0 = abs( {{{2}}} - 1 )
| {{#ifexpr: {{{1}}} * {{{2}}} round 0 < 0
ފޮޅުވަތް 28:
| {{color | red | This fractional rounding function only accepts positive intergers as the denominator. }}
}}
</syntaxhighlight>
Sub-template {{tl|rndfrac/out}}
<
{{#ifeq: {{{2}}} | 0
| {{{1}}}
ފޮޅުވަތް 37:
| {{{1}}}<sup> </sup>
}}{{#iferror: {{#expr: 1/{{{4}}} }}
| <sup>{{{2}}}</sup>
| <sup>{{#expr: {{{2}}} / {{{4}}} }}</sup>
}}
</span>
}}
</syntaxhighlight>
== See also ==
*{{tl|rnd}}
*{{tl|rndnear}}
*{{tl|dec to frac}}
<includeonly>[[
|