Difference between revisions of "Template:Convert/numdisp"
From Teampedia
(Created page with "<noinclude><!-- --============================================================ -- Display a number, with optional fraction part: 6+3/8 --======================================...") |
|||
Line 8: | Line 8: | ||
|{{Convert/numdisp/frac | |{{Convert/numdisp/frac | ||
|{{{1|-1200-3/118}}}|{{#titleparts:{{{1|-1200-3/118}}}|1|1}}|{{#titleparts:{{{1|-1200-3/118}}}|1|2}}}}<!--split at "/" | |{{{1|-1200-3/118}}}|{{#titleparts:{{{1|-1200-3/118}}}|1|1}}|{{#titleparts:{{{1|-1200-3/118}}}|1|2}}}}<!--split at "/" | ||
− | --else-->|{{#ifexpr:{{{1|-14000.00}}} < 0 | + | --else-->|{{#ifexpr:{{{1|-14000.00}}}*0 = 0 and {{{1|-14000.00}}} < 0 |
|<!--then re-build negative number (see NOTE Z4 below) | |<!--then re-build negative number (see NOTE Z4 below) | ||
-->{{formatnum: | -->{{formatnum: | ||
− | {{padright:−<!--&minus-->{{#expr:-{{{1|-14000.00}}} }}<!--endexpr | + | {{padright:−<!--&minus-->{{#expr:-( {{{1|-14000.00}}} ) }}<!--endexpr |
--put decimal if needed-->{{ | --put decimal if needed-->{{ | ||
#ifexpr:{{{1|-14000.00}}}0={{{1|-14000.00}}} | #ifexpr:{{{1|-14000.00}}}0={{{1|-14000.00}}} | ||
and {{{1|-14000.00}}}=floor( {{{1|-14000.00}}} )|.}}<!-- | and {{{1|-14000.00}}}=floor( {{{1|-14000.00}}} )|.}}<!-- | ||
− | -->|{{ | + | padlength-->|{{#expr: |
+ | {{str len|{{{1|-14000.00}}}|}}<!--endstr len--> + {{ | ||
+ | #ifeq:&minus| {{padleft:|6|{{{1|x}}} }} |-6|0}} }}<!--endexpr | ||
-->|0}}<!--endpadright end-zeroes "0" to original length | -->|0}}<!--endpadright end-zeroes "0" to original length | ||
-->}}<!--endformatnum | -->}}<!--endformatnum | ||
Line 74: | Line 76: | ||
--17Feb11 Used {padright:} to re-add end-zeroes on negatives. | --17Feb11 Used {padright:} to re-add end-zeroes on negatives. | ||
--17Feb11 Used #ifexpr:{1}0={1} and floor({1})={1}, to put "." | --17Feb11 Used #ifexpr:{1}0={1} and floor({1})={1}, to put "." | ||
+ | --30Nov13 Fixed to allow prefix "−" as extra 6 long. | ||
+ | --07Jan14 Fixed to pass negative sum without padding "0". | ||
-- | -- | ||
** Add interwiki links to /doc subpage to avoid changes here ** | ** Add interwiki links to /doc subpage to avoid changes here ** | ||
-- | -- | ||
− | --> | + | --> |
+ | [[Category:Subtemplates of Template Convert]] | ||
</noinclude> | </noinclude> |
Latest revision as of 20:53, 10 April 2020
−14,000.