Jump to content

Template talk:T&Fcalc

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Rounding down

[edit]

Is there a reason the template rounds down to the nearest quarter inch? For example, 1.2 metres is ~3 ft 11.244094488189 in; the template rounds this down to 3 ft 11 in instead of up to 3 ft 11+14 in. If there is no reason for this, {{convert| |m|ftin|frac=4}} could be used instead. Jimp 10:20, 8 November 2015 (UTC)[reply]

The template properly follows the rounding rules of Track and Field, not mathematics in general, that is why it is a sport specific calculator. Trackinfo (talk) 18:52, 8 November 2015 (UTC)[reply]

0+14

[edit]

The template gives "0+14 in", "0+12 in" and "0+34 in", e.g.

  • {{T&Fcalc|1.231}} → 1.231 m (4 ft 14 in)
  • {{T&Fcalc|1.236}} → 1.236 m (4 ft 12 in)
  • {{T&Fcalc|1.241}} → 1.241 m (4 ft 34 in)

Why the zeros? Jimp 10:20, 8 November 2015 (UTC)[reply]

@Jimp: This is due to the template largely being a mathematical function. It's possible to remove the zero when there is only a fraction of inches, but it's basically going to double the complexity of the code. You'd need to handle for different outcomes when there are (a) full inches and fractions, (b) fractions but no full inches, (c) full inches and no fractions, and (d) no full inches or fractions).
There also the question of whether it would be non-standard to exclude the zero, as typically in track results the zeros are stated to indicate the precision (as opposed to less precisely measured marks). See the USATF converter for example. SFB 18:44, 8 November 2015 (UTC)[reply]
I didn't see this thread before I refactored it to use {{convert}} for the ft and in. if you feel strongly about the 0, then please feel free to change it back. Frietjes (talk) 15:26, 23 October 2018 (UTC)[reply]