Template:Convert/testcases/rounding

From MattWiki
Jump to: navigation, search

These tests are looking at using combinations of the round_to, disp=5 and sigfig=number parameters.

The processing order should be as follows:

  • If round_to is specified then round the result to the number of decimal places specified.
  • If sigfig is specified then reduce the significant figures to the amount specified.
  • If disp=5 is specified then round to the nears whole 5.
Convert Code Convert (Old) Convert (Sandboxlua) Result
{{convert|1234.56789|in|m}} 1,234.56789 inches (31.358024 m) 1,234.56789 inches (31.358024 m) Exact Match
{{convert|1234.56789|in|m|3}} 1,234.56789 inches (31.358 m) 1,234.56789 inches (31.358 m) Exact Match
{{convert|1234.56789|in|m|disp=5}} 1,234.56789 inches (30 m) 1,234.56789 inches (30 m) Exact Match
{{convert|1234.56789|in|m|sigfig=3}} 1,234.56789 inches (31.4 m) 1,234.56789 inches (31.4 m) Exact Match
{{convert|1234.56789|in|m|3|disp=5}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.358 m) Different
{{convert|1234.56789|in|m|3|sigfig=3}} 1,234.56789 inches (31.4 m) 1,234.56789 inches (31.358 m) Different
{{convert|1234.56789|in|m|3|disp=5|sigfig=3}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.358 m) Different
{{convert|1234.56789|in|m|7|disp=5}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.3580244 m) Different
{{convert|1234.56789|in|m|7|sigfig=3}} 1,234.56789 inches (31.4 m) 1,234.56789 inches (31.3580244 m) Different
{{convert|1234.56789|in|m|7|disp=5|sigfig=3}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.3580244 m) Different
{{convert|1234.56789|in|m|disp=5|sigfig=3}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.4 m) Different
{{convert|1234.56789|in|m|3|disp=5}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.358 m) Different
{{convert|1234.56789|in|m|sigfig=7}} 1,234.56789 inches (31.35802 m) 1,234.56789 inches (31.35802 m) Exact Match
{{convert|1234.56789|in|m|3|sigfig=7}} 1,234.56789 inches (31.358 m) 1,234.56789 inches (31.358 m) Exact Match
{{convert|1234.56789|in|m|3|disp=5|sigfig=7}} 1,234.56789 inches (30 m) 1,234.56789 inches (31.358 m) Different
{{convert|991234.56789|in|m}} 991,234.56789 inches (25,177.358024 m) 991,234.56789 inches (25,177.358024 m) Exact Match
{{convert|991234.56789|in|m|3}} 991,234.56789 inches (25,177.358 m) 991,234.56789 inches (25,177.358 m) Exact Match
{{convert|991234.56789|in|m|disp=5}} 991,234.56789 inches (25,175 m) 991,234.56789 inches (25,175 m) Exact Match
{{convert|991234.56789|in|m|sigfig=3}} 991,234.56789 inches (25,200 m) 991,234.56789 inches (25,200 m) Exact Match
{{convert|991234.56789|in|m|3|sigfig=3}} 991,234.56789 inches (25,200 m) 991,234.56789 inches (25,177.358 m) Different
{{convert|991234.56789|in|m|3|disp=5}} 991,234.56789 inches (25,175 m) 991,234.56789 inches (25,177.358 m) Different
{{convert|991234.56789|in|m|3|disp=5|sigfig=3}} 991,234.56789 inches (25,200 m) 991,234.56789 inches (25,177.358 m) Different
{{convert|991234.56789|in|m|disp=5|sigfig=3}} 991,234.56789 inches (25,200 m) 991,234.56789 inches (25,200 m) Exact Match
{{convert|991234.56789|in|m|disp=5|sigfig=8}} 991,234.56789 inches (25,175 m) 991,234.56789 inches (25,177.358 m) Different