Template:Datacalc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 2: Line 2:
{{Todo|Documentation}}
{{Todo|Documentation}}
{{Todo|Implement input filesize parameter that determines the exponentiation of the output filesize.}}
{{Todo|Implement input filesize parameter that determines the exponentiation of the output filesize.}}
{{Todo|Implement a switch that swaps out the expression's decimal prefix for a binary prefix.}}
<onlyinclude><includeonly>
<onlyinclude><includeonly>
{{#expr:{{{1|0}}} {{#switch:{{{output}}}
{{#expr:{{{1|0}}} {{#switch:{{{output}}}
                       | quettabytes | qb = / 10^30
                       | quettabytes | qb = / 10^30
                       | ronnabytes  | rb = / 10^27
                       | ronnabytes  | rb = / 10^27
                       | yottabytes  | yb = / 10^24
                       | yottabytes  | yb = {{#switch:{{{prefix}}}|binary=* 2^80|#default=/ 10^24}}
                       | zettabytes  | zb = / 10^21
                       | zettabytes  | zb = {{#switch:{{{prefix}}}|binary=* 2^70|#default=/ 10^21}}
                       | exabytes    | eb = / 10^18
                       | exabytes    | eb = {{#switch:{{{prefix}}}|binary=* 2^60|#default=/ 10^18}}
                       | petabytes  | pb = / 10^15
                       | petabytes  | pb = {{#switch:{{{prefix}}}|binary=* 2^50|#default=/ 10^15}}
                       | terabytes  | tb = / 10^12
                       | terabytes  | tb = {{#switch:{{{prefix}}}|binary=* 2^40|#default=/ 10^12}}
                       | gigabytes  | gb = / 10^9
                       | gigabytes  | gb = {{#switch:{{{prefix}}}|binary=* 2^30|#default=/ 10^9}}
                       | megabytes  | mb = / 10^6
                       | megabytes  | mb = {{#switch:{{{prefix}}}|binary=* 2^20|#default=/ 10^6}}
                       | kilobytes  | kb = {{#switch:{{{prefix}}}|binary=* 2^10|#default=/ 10^3}}
                       | kilobytes  | kb = {{#switch:{{{prefix}}}|binary=* 2^10|#default=/ 10^3}}
                       | #default        = / 1  <!-- Default expression assumes conversion of bytes to bytes, i.e.: no conversion performed. -->
                       | #default        = / 1  <!-- Default expression assumes conversion of bytes to bytes, i.e.: no conversion performed. -->
Line 20: Line 19:
| quettabytes | qb = quettabytes
| quettabytes | qb = quettabytes
| ronnabytes  | rb = ronnabytes
| ronnabytes  | rb = ronnabytes
| yottabytes  | yb = yottabytes
| yottabytes  | yb = {{#switch:{{{prefix}}}|binary=yobibytes|#default=yottabytes}}
| zettabytes  | zb = zettabytes
| zettabytes  | zb = {{#switch:{{{prefix}}}|binary=zebibytes|#default=zettabytes}}
| exabytes    | eb = exabytes
| exabytes    | eb = {{#switch:{{{prefix}}}|binary=exbibytes|#default=exabytes}}
| petabytes  | pb = petabytes
| petabytes  | pb = {{#switch:{{{prefix}}}|binary=pebibytes|#default=petabytes}}
| terabytes  | tb = terabytes
| terabytes  | tb = {{#switch:{{{prefix}}}|binary=tebibytes|#default=terabytes}}
| gigabytes  | gb = gigabytes
| gigabytes  | gb = {{#switch:{{{prefix}}}|binary=gibibytes|#default=gigabytes}}
| megabytes  | mb = megabytes
| megabytes  | mb = {{#switch:{{{prefix}}}|binary=mibibytes|#default=megabytes}}
| kilobytes  | kb = {{#switch:{{{prefix}}}|binary=kibibytes|#default=kilobytes}}
| kilobytes  | kb = {{#switch:{{{prefix}}}|binary=kibibytes|#default=kilobytes}}
| #default = bytes
| #default = bytes
}}}}<includeonly></onlyinclude>
}}}}<includeonly></onlyinclude>

Revision as of 11:10, 1 June 2023

This template interprets a numbered input string in bytes and converts it to your specified output filesize. For a logical use-case, see Template:Infobox template.

Todo: Documentation
Todo: Implement input filesize parameter that determines the exponentiation of the output filesize.