"ढाँचा:Precision" का संशोधनहरू बिचको अन्तर
Content deleted Content added
Replacing with code from talk page. |
created, as utility template, to get precision of any number, large or negative, using a fast algorithm |
||
पङ्क्ति १:
<noinclude><!--
--============================================================
-- Getprecision - Get precision of number as decimal digits
--============================================================
-- (see NOTES at bottom)
--
--></noinclude>{{#expr: {{str_len|{{{1|15.1230}}}}} <!--
--> - {{ordomag|{{{1|15.1230}}} }} - 1 <!--
--> {{#ifexpr: {{{1|15.1230}}}={{{1|15.1230}}}0 | - 1}}<!--
--> {{#ifexpr: {{{1|15.1230}}} < 0| - 1}} }}<noinclude><!--
--
--------------------------------------------------------------
--NOTES:
--
--NOTE A1: This template determines the precision of a number
-- by counting the length of the numeric string, then
-- subtracting integer length, minus the decimal point if
-- not an integer, minus 1 if negative.
--
---------------------------------------------------------------
--HISTORY:
--15Aug10 Created to get precision even if large or negative.
--15Aug10 Put NOTES comments to explain template coding.
--15Aug10 Put HISTORY comments to log major changes.
--
-->
<br>The '''Template:Getprecision''' determines the precision (as a count of decimal digits) for any amount, large or negative, using
a fast algorithm. It can also handle a trailing decimal point (such
as "15." or "-41.") or trailing zeroes (such as "15.34000" having precision as 5 decimal digits).
===Examples===
Some examples:
: <nowiki>{{precision| -15.123}}</nowiki> → {{precision| -15.123}}
: <nowiki>{{getprecision| -15.123}}</nowiki> → {{getprecision| -15.123}}
: <nowiki>{{getprecision| -15.2500}}</nowiki> → {{getprecision| -15.2500}}
: <nowiki>{{Getprecision |23000222000111.432}}</nowiki> → {{Getprecision |23000222000111.432}}
==See also==
* [[Template:Precision]] - get precision of positive numbers
[[Category:Mathematical function templates]]
</noinclude>
|