Template talk:Val

From Wikipedia, the free encyclopedia

WikiProject Physics This page is within the scope of WikiProject Physics, which collaborates on articles related to physics.


Contents

[edit] Introduction Q&A

(This is a trimmed version of the initial discussions, reduced in size for clarity)
  • Q: Doesn't it take longer to add this template than it would be to just type the value, and either use the ± key on a keyboard (as my apple mac has), or use the button in the "Insert:" bar below the edit summary box?
A: Yes, it may be longer, but this template has the following benefits:
  1. It makes sure the value does not wrap at the end of a line, so that it can always be read as a single value on one line in the text.
  2. It's easier to use if you do not have a ± key.
  3. It automatically replaces "-" (dash) with a "−" (minus sign).
  4. It automatically formats numbers by inserting comma's into large numbers and spaces between decimal digits.
  5. It automatically puts spaces between the various parts of the value where they should be.
  6. You can easily add exponents of 10 and units
  7. All this makes sure all values on all pages have the same look and feel because they will all use the same spacing, font size, positioning, etc...
  8. Makes updating, checking, etc... by bots easier because they can recognize a value for what it is.
  9. Easier updates: should there be a new style guide or a change in the old one, it's easy to adjust a lot of pages in one go when you use templates like this.
  • Q: Should all values on wikipedia be replaced by this template?
A: At some point, yes, probably. The template is currently in development and we're running into small issues while manually applying it to various pages. These issues will get fixed and changes to the template means that we may have to edit pages that we're already using it to update them to use the modified template correctly (see breaking changes). Once we're confident that there won't be any big changes, we'll see about getting a bot to replace as many values as possible.
  • Q: Who's working on this templates ?
A: A small number of people, I'll probably post at Wikipedia:Village pump to let people know about the template soon.
  • Q: Why not use <math> ?
A: Because the font in math tags differs both in face and size from the rest of the page. <math> is great for complex formulae by themselves, but looks rather bad if you want to put a value amongst text. Also, you cannot copy+paste the data from an image.
A: The delimitnum functionality has been copied into this template. {{delimitnum}} is not widely used.

-- SkyLined (talk) local time:12:48, 14 April 2008 (CET), server time: 11:48, 14 April 2008 (UTC)

[edit] New units feature

I added a feature that automatically translates easy to type unit names to proper HTML display of the unit, optionally with a link. See the documentation for the u argument and the examples for details. See the {{ScientificValue/units}} template for a list of supported units. Feel free to add more when needed.

I've added all units supported by {{convert}}. JЇѦρ 17:33, 8 April 2008 (UTC)

That doesn't seem to work correctly: See Scientific_Notation#Significant figures for an example:

{{val|1.602176487|(40)|e=−19|u=C}} (Coulomb) -> 1.602176487(40)×10−19 C
-- SkyLined (talk) 10:04, 9 April 2008 (UTC)
Thanks for the heads-up. I've fixed it also adding the farad which would have given us the same problem. {{Convert}} uses plain C and F for Celsius & Fahrenheit but we were getting a red link because ... it's complicated ... JЇѦρ 15:13, 9 April 2008 (UTC) ... and the rayleigh (same again). JЇѦρ 15:31, 9 April 2008 (UTC)

[edit] Deprecating redirects

I think {{val}} is the shortest, easiest to remember name for this template. Having the other two names complicates things without added benefit:

  • I have deprecated {{Sci}} immediately - it is not actively used.
  • We can keep {{val}} as a redirect to {{ScientificValue}} or
  • We can move {{ScientificValue}} to {{val}} and {{ScientificValue/units}} to {{val/units}}. That we we can deprecate the longer versions as well, cleaning up the name space. Unles anybody has a good reason not to do this, I will make this change in the near future.
    -- SkyLined (talk) 09:48, 9 April 2008 (UTC)
I've tagged {{ScientificValue/Units}} for deletion. JЇѦρ 17:20, 9 April 2008 (UTC)

I personally don't think it's a problem to have multiple redirects to a template. It lets the users choose whichever name is either easiest to type or easiest to remember (or some combination of the two). Plus, it sometimes helps users find the template if they don't a priori know the name of the template (e.g. you guess scientificvalue will be a template for displaying a scientific value). I wouldn't go about creating new redirects, but if they exist already then it's probably not expending the effort to delete them. Mike Peel (talk) 21:16, 9 April 2008 (UTC)

Having multiple names for one thing adds confusion and may have people think that there is a difference. I would much rather see an error message when you use the wrong template that explains which template should be used instead.


[edit] Look and feel

[edit] Parenthesis

Just to let you know that when you write things like 1,234±35×10−23 or 1,234+12−12×1010, it is very uncommon to have the parenthesis. I don't think they should be there by default. Headbomb (talk) 21:48, 9 April 2008 (UTC)

I agree, I've removed them, Maybe Mike wants to explain why he added them? -- SkyLined (talk) local time:14:53, 13 April 2008 (CET), server time: 13:53, 13 April 2008 (UTC)
Because unless they are there, I read it as 1234 with an error of 35 × 10 − 23, which is ridiculous. By putting both numbers in brackets, it makes it obvious that the × 10 − 23 applies to both numbers. Mike Peel (talk) 16:58, 13 April 2008 (UTC)
With all due respect, if you do not know how to interpret a certain notation, it is not the notation that is at fault. Let's try to follow commonly used convensions as much as possible and try to keep personal preferences out. (It is very unlikely we'll ever find a notation that everybody likes). I would suggest that we try to find some trustworthy references on the use of these notations, so we can implement the most commonly used one. -- SkyLined (talk) local time:09:30, 14 April 2008 (CET), server time: 08:30, 14 April 2008 (UTC)

[edit] minus vs dash

The template now automatically represents negative numbers using the minus sign (−) instead of a dash (-) but you will need to write the number using a dash to make it a negative number! (Eg. {{val|-1}} instead of {{val|&minus;1}} or {{val|−1}}). This applies to exponent and uncertainty as well. -- SkyLined (talk) local time:12:53, 14 April 2008 (CET), server time: 11:53, 14 April 2008 (UTC)

[edit] Space between value and (uncertainty)

This has been removed; NIST uses no space.

[edit] Bugs in template

If you find a bug in this template, please let us know exactly what the problem is and try to avoid using {{val}} itself in examples: if you see something odd because your browser is odd, then others may not see what you see because they use a different browser. If possible, make a screengrab and dump it on the web somewhere, so we can see what you see. And please also let us know what type and version of browser and operating system you are using.

[edit] NOWRAP

...doesn't work. Go to the {{val/test}} page and shrink it's size so you can see the values wrap... Has anybody got a clue how to fix this? -- SkyLined (talk) 08:27, 17 April 2008 (UTC)

[edit] Trailing zeros missing

Can someone fix the bugs in: {{val|1.2340|0.0050}} → 1.234±0.5

so that it displays 1.2340±0.0050? Mjamja (talk) 18:28, 18 April 2008 (UTC)

This is a known issue, there is a theorethical fix, which I will try to implement soon.-- SkyLined (talk) 19:02, 22 April 2008 (UTC)

[edit] IE6

Exponents of 10 do not appear. For example, {{val|5|e=6|u=m}} appears as 5×106 m and this has made many articles unreadable. Q43 (talk) 02:55, 1 May 2008 (UTC)

What's wrong with how 5×106 m appears? Looks like 5 x 106 m to me.Headbomb (talk · contribs) 03:05, 1 May 2008 (UTC)

Over here it appears 5 x 10   m  !!! Q43 (talk) 03:14, 1 May 2008 (UTC)

Browser problem?Headbomb (talk · contribs) 04:38, 1 May 2008 (UTC)

Yeah, this problem happens with IE6 and is a problem in the way {{su}} creates sub/sup script, which is really complex because FireFox sucks. I may look into it at some point but don't hold your breath. Feel free to try and solve it yourself :). Btw. If you have IE6, can you let me know if this: 1+2−3×104 contains the numbers 1, 2, 3 and 4? The 4 (exponent) should be missing, as reported, but I'm interested to hear if the 2 and 3 are visible at all? Thanks    — SkyLined {talkcontribs 01:59, 4 May 2008 (UTC)
I've created a temporary, partial fix by modifying {{su}} to use <sup> and <sub> when only sub- or sup-script is needed. When both are needed it still uses the original code, which does not wok for IE6. This means that uncertainty with two numbers, one over the other, does not work.     — SkyLined {talkcontribs 22:10, 4 May 2008 (UTC)

[edit] Precision bug

{{val|2.6033|0.0005|e=-8}} doesn't look like it's supposed to. Right now, it looks like (2.603299±0.0005×10−8), but should look like 2.603 3 x 10-8. - Unknown (please SIGN your posts!)

Seems to me like a precision problem; {{val}} uses math to calculate where to put spaces. This math is limited by the precision of the math module of wikipedia, which undoubtedly uses double or float. Apparently the precision is not sufficient to prevent rounding errors from modifying the value :(. The best way to solve this is to move away from math and use string functions. Unfortunately, they are not installed on wikipedia. Possible solutions:
  • Drop the formatting - this would violate the MOS.
  • Attempt to work around the rounding error - really complex, if at all possible.
  • Get wikipedia to install the string ParserFunctions modules - no clue if that's going to happen or how to request that.
  • Get some server side script in php do this - no clue if that's going to happen or how to request that.
    — SkyLined {talkcontribs 22:16, 4 May 2008 (UTC)

[edit] linking

It needs to be possible to _not_ link to the unit - i had to fix a few self-links in Kilogram. --Random832 (contribs) 21:18, 19 April 2008 (UTC)

Fixed with new arguments:

  • u = units
  • ul = units with link
  • up = units per
  • upl = units per with link

This means that effective immediately, all links have been removed from existing use of {{val}}. I assumed that this was not a mayor problem, you can add the link back in any instance of {{val}} by replacing u= and up= with ul= and upl= respectively. -- SkyLined (talk) 20:05, 22 April 2008 (UTC)

[edit] New {{val}} convention

I've taken the liberty to prune some of the old chat and summarized the main points of discussion. Please supply references where appropriate, especially if you make claims about guidance provided by third parties. Please refrain from putting your personal opions here, unles you are (somewhat of) an autority on the matter or if we really cannot find any proper guidance to follow. (To prove that personal opinion is bunk; I'd like to see all numbers printed backwards, in pink Wingdings, so let's not go there) -- SkyLined (talk) 10:20, 23 April 2008 (UTC)

Problem:

The problem is that there is some debate over automatic separation of groups of digits in long numbers into 123,123,123 and 0.123 123 123 (instead of 123123123 and 0.123123123). It has been suggested that this should be a feature that can be switched on and off.

Arguments:

  • The Manual of Style on large numbers and the results of the {{delimitnum}} discussions say that all wikipedia pages should use comma seperators for the digits before the decimal dot and thin spaces for the digits after it.
  • The main Manual of Style suggests that all pages across wikipedia should have the same look and feel as much as possible and individual pages should use the same style throughout, unles there is a good reason for discrepancy.
  • SI usage specifications clearly define against the use of comma's in large numbers, due to the possible confusion that may arise in different countries. SI suggests either spaces (123 123 123.123 123) or nothing at all (123123123.123123). commas should never be used. [1]
  • Commas actually make the number harder to read [1].
  • Commas are frowned upon by scientific organizations, they follow the SI guidelines, and so will not use commas for grouping digits.
  • Using {{val}} should be as easy as possible and not become a lot harder than typing the number as is. (Otherwise, no one will use it, which defeats its purpose.)

Options:

  • Possible options for the digit group seperator are: comma, thin space and nothing.
  • We can choose one seperator for all values or we can have one for "normal" values and another for scientific values.

{{val}} can be updated to allow you to choose between the two, should we choose the second option. Creating another template for this is also an option.

I'd support the user-specified seperation. By default it should follow the MoS for "normal" numbers ({{val|sd|123456789.987654321}} giving 123,456,789.987 654 321 and {{val|sd|123456789.987654321}} giving 123 456 789.987 654 32 for (sd=scientific delimitation). Headbomb (talk · contribs) 13:58, 28 April 2008 (UTC)

Discussion:

Please add anything you'd like to add here, or under one of the sub-sections above.

[edit] References

  1. ^ a b http://physics.nist.gov/Pubs/SP811/sec10.html#10.5.3 NIST-Grouping Digits

  • In case we end up choosing different seperators for "normal" numbers and scientific values, I am against creating a second template and would rather see an extra argument to {{val}}. The reason for this is maintenance: there is a good chance that somebody will change one template and forget to change the other as well, causing differences between the two and thus differences between pages that use them, which is what this template is meant to prevent. Should a second template make things easier to the user, I suggest we make it a wrapper for {{val}} that adds the argument I suggested, so that we also won't have the maintenance issue. -- SkyLined (talk) 10:20, 23 April 2008 (UTC)

[edit] val template has a serious flaw

This one is a deal-breaker, folks.

Over on the light-year article, {{val|3.086|e=13|u=kilometers}} displays as 3.86, when it should display as 3.086. I'm not good enough at the scripting to see why it drops that zero, but it does. Rhialto (talk) 05:34, 23 May 2008 (UTC)

I was the one who put {{val}} onto Light-year not realising that there was a problem ... yeah, and not checking. The fact that {{val|3.860|e=13|u=kilometers}} gives "3.86×1013 kilometers" is bad enough but {{val|3.086|e=13|u=kilometers}}'s giving the same is, as Rhialto says, a deal-breaker. Both problems have got to be fixed if this template is to be of any use. JIMp talk·cont 06:56, 27 May 2008 (UTC)

[edit] Option for percent uncertainty

I am missing an option for a number with a percentual uncertainty like 1.23±4% × 105. Trying {{val|1.23|4%|e=5}} results in an error message. −Woodstone (talk) 21:09, 27 May 2008 (UTC)

This type of uncertainty is not supported at this point.     — SkyLined {talkcontribs 15:22, 11 June 2008 (UTC)

[edit] Breaking four-digits numbers

I think that numbers with fewer than five digits before the decimal point look better without a thousand separator, e.g. 2008 rather than 2,008. Does anyone agree with me? --Army1987 (talk) 12:00, 9 June 2008 (UTC)