Template:Round1: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>David Yamakuchi
mNo edit summary
imported>David Yamakuchi
mNo edit summary
Line 3: Line 3:
   |{{#ifeq:"{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{#expr:{{{MassDecimalPlaces|}}}-1}} }}"|"{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{#expr:{{{MassDecimalPlaces|}}}-2}} }}"
   |{{#ifeq:"{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{#expr:{{{MassDecimalPlaces|}}}-1}} }}"|"{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{#expr:{{{MassDecimalPlaces|}}}-2}} }}"
   |{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}{{#ifeq:{{{MassDecimalPlaces|}}}|2|.00|{{#ifeq: "{{:{{{eName|}}}/Atomic mass}}"|"{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}"||00}}}}
   |{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}{{#ifeq:{{{MassDecimalPlaces|}}}|2|.00|{{#ifeq: "{{:{{{eName|}}}/Atomic mass}}"|"{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}"||00}}}}
   |{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}{{#ifeq:{{{MassDecimalPlaces|}}}|1|.0|0}}}}
   |{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}{{#ifeq:{{{MassDecimalPlaces|}}}|1|.0|0*}}}}
   |{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}}}
   |{{#expr: {{:{{{eName|}}}/Atomic mass}} round {{{MassDecimalPlaces|}}} }}}}
   |{{#ifeq:"{{:{{{eName|}}}/Atomic mass}}"|"({{#expr: {{:{{{eName|}}}/Atomic mass}}}})"
   |{{#ifeq:"{{:{{{eName|}}}/Atomic mass}}"|"({{#expr: {{:{{{eName|}}}/Atomic mass}}}})"

Revision as of 11:01, 18 June 2008

This template was constructed to round the atomic mass numbers to one, two, or more places after the decimal for {{Resizable periodic cell}} (for {{PTofE}}.)

Note: This thing is a hack. It is way too big and it doesn't even cover all the possible cases of truncation of rounded zeros. If someone knows how to properly retain the trailing zeros for rounded numbers _without_ making the code ridiculously large, then please by all means lend a hand...dy