Template talk:Val
Add topic| Template:Val is indefinitely protected from editing as it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify a template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
| This is the talk page for discussing improvements to the Val template. |
|
| Archives: 1, 2, 3, 4, 5, 6, 7, 8Auto-archiving period: 3 months |
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
The template {{Val2}} was considered for deletion on 2014 February 7. The result of the discussion was "move to Template:Val/sandbox2". |
Automatic conversion from confidence interval to +/-uncertainty
[edit]In medicine and biology a lot of values are given as the 95% confidence interval (or Bayesian HPD interval) instead of the +/-uncertainty. However, the {{val}} notation is often preferable in tight spaces such as the sub-labels of {{clade}}. Currently to format a number such as 42190 (95% HPD: 23554-77587), one would have to subtract both numbers from 42190 to arrive at {{val|35397|17636}}. Using #expr: is possible but still unwieldy to type.
It would be very helpful if Module:Val could accommodate this kind of use case by adding an option that causes it to treat an "asymmetric uncertainty" as an interval to convert into the +/- notation. Or if there is a similarly compact way to notate such an interval with a center value (be it the mean or the peak of the probability density). Artoria2e5 🌉 05:02, 19 June 2026 (UTC)
- I'm totally lost. When doing it manually, you have to subtract two numbers from a third number. I can't see what numbers you mean in the above example. Please clarify. I gather you are looking for ideas at the moment but if you have something in mind, it would be helpful if you could list some sample wikitext (hypothetical parameters to val) and what output they would produce. Johnuniq (talk) 06:24, 19 June 2026 (UTC)
- I may be wrong, but in your example of "42190 (95% HPD: 23554–77587)", '42190' represents a mean value for a distribution that is not necessarily normal; by re-calculating it to 35397±17636, you're altering the meaning of the data, by stating the mean value is 35,397 with range of +/−17636. The mean and Bayesian range points are the "hard data", and presenting it differently is misrepresenting the data.
- Also, I think what you're trying to do is incorrect, according to the confidence interval article (emphasis mine):
— sbb (talk) 15:57, 4 August 2026 (UTC)Credible intervals are a Bayesian analog to confidence intervals in frequentist statistics. The two concepts arise from different philosophies: Bayesian intervals treat their bounds as fixed and the estimated parameter as a random variable, whereas frequentist confidence intervals treat their bounds as random variables and the parameter as a fixed value. Also, Bayesian credible intervals use (and indeed, require) knowledge of the situation-specific prior distribution, while the frequentist confidence intervals do not.
Add ppt & ppq (parts per trillion/quadrillion) units?
[edit]For completeness' sake, and because four (ppm, ppb, ppt, ppq) are bold-mentioned (defined) in the Parts-per notation article, and their corresponding parts per million, parts per billion, parts per trillion, and parts per quadrillion links are all redirects to the same Parts-per notation article, can we have the following lines added just below ppm (currently line 657):
ppq [[Parts per quadrillion|ppq]] 1e-15
ppt [[Parts per trillion|ppt]] 1e-12
re: ppt = thousand/trillion ambiguity: per mil/mill/mille are already well-covered for parts-per-thousand. — sbb (talk) 17:00, 4 August 2026 (UTC)
- Assuming this is going to be used, I made that edit. Johnuniq (talk) 06:15, 5 August 2026 (UTC)
- I was mid-edit hoping for the change. Thanks! =) — sbb (talk) 23:19, 5 August 2026 (UTC)
Screen readers
[edit]I've noticed that the numbers formatted with gaps cause problems in Apple's VoiceOver screen reader. For example, {{val|123456.78901}}, which outputs 123456.78901, is read by VoiceOver in four groups: "one hundred twenty three" / "four hundred fifty six" / "seven hundred eighty nine" / "zero one". It should instead be one group, read as "one hundred twenty three thousand four hundred fifty six point seven eight nine zero one". With commas, i.e. using |fmt=commas (output: 123,456.78901), VoiceOver reads it correctly.
I'm testing on Safari with iOS 26.5. I don't know how other screen readers handle it, but it would probably be a good idea to test it in other screen readers too.
Can we adjust the HTML output of {{Val}} to make it work with VoiceOver? If someone finds a good solution, it could be applied to {{Gaps}} and {{Convert}} too.
Lugel (talk) 10:54, 17 August 2026 (UTC)
- This sounds like a VoiceOver bug or misfeature. Both the main Windows screen readers, NVDA and JAWS, read the template fine, but the latter had problems with it in Chrome until I reported a bug about it to their manufacturer (see Template talk:Val/Archive 7 § Screen reader problems with digits grouped by spaces in this template). VoiceOver is notoriously not well-maintained so I don't think reporting a bug there would be fruitful in the short/medium term (but then, I said the same about JAWS, and was pleasantly surprised about how quickly they got on top of it. But I think JAWS is more actively worked on than VoiceOver and support people for JAWS are much easier to get a hold of. Graham87 (talk) 14:31, 17 August 2026 (UTC)
- Just tested on Firefox on iOS 26.5. Read & Speak (which I believe is mechanically similar to VoiceOver) reads the template correctly. Toast of Fate ♡ talk to me! 22:11, 24 August 2026 (UTC)
ergs and other instances of linking not the exact unit text
[edit]I noticed an issue regarding this template in the article Foe (unit). In the first Line the Val Template is used for a Unit called an "erg", but which has to be written "ergs" because of the sentence structure. The Template automatically links to ergs, even though it should redirect to Erg (unit). I have found no way within the Val Template to fix this. I might have just missed something, but as far as i see, there is no way for a unit to link to anything except its exact text, including grammatical particles like the plural -s. I think this is a problem. one might also imagine other circumstances where one may want to make a unit link to something except its exact text, like maybe having m/s link to velocity, not meters per second. I don't know if it is feasible to fix this without breaking the Template since it's so heavily used, but I wanted to let you guys know of this issue. Wikipedian of Gondor (talk) 08:36, 8 September 2026 (UTC)
- If val has a definition for a unit, the parameter
ulwill use whatever link is in that definition. Otherwise, val puts[[before and]]after whatever text was specified byul. Ifergswere needed often, it would make sense to define a unit for it. However, it is not reasonable to have enough definitons to cover every possibility. In that case, simply use parameteruand give whatever wikitext you like. Examples: - The second line above (using {{10^}}) works well but a line break may occur between the number and the unit. That is ok according to MOS:UNIT. If wrapping is not wanted, {{nowrap}} could be used although that would make val easier. Johnuniq (talk) 09:28, 8 September 2026 (UTC)
- I briefly thought it could be done with {{convert}} but
{{convert|1|foe|erg|disp=out|abbr=off|lk=out}}gives 1.0×1051 ergs. There's no way to suppress that "1.0×", is there? Such a rare want. NebY (talk) 11:04, 8 September 2026 (UTC)- No, the 1.0 can't be removed. And, someone pointed out that erg links to the wrong page at Template talk:Convert#Disambiguate the unit 'erg'. Fixing that is on my to-do list. Johnuniq (talk) 11:56, 8 September 2026 (UTC)
- Thanks and thanks! NebY (talk) 12:00, 8 September 2026 (UTC)
- No, the 1.0 can't be removed. And, someone pointed out that erg links to the wrong page at Template talk:Convert#Disambiguate the unit 'erg'. Fixing that is on my to-do list. Johnuniq (talk) 11:56, 8 September 2026 (UTC)
- I briefly thought it could be done with {{convert}} but
- I just came here to report exactly the same issue with exactly the same article. I've decided to implement Johnuniq's first suggestion. --Redrose64 🌹 (talk) 19:25, 2 October 2026 (UTC)
Requesting K-1, etc. for Thermal expansion (temp. coefficient)
[edit]I'm trying to notate some thermal expansion coefficients, which are in units of "[unitless] per Kelvin", or simply "K−1".
Can I have a template editor add
K-1 [[Thermal expansion|K<sup>−1</sup>]]
°C-1 [[Thermal expansion|°C<sup>−1</sup>]]
°F-1 [[Thermal expansion|°F<sup>−1</sup>]]
°R-1 [[Thermal expansion|°R<sup>−1</sup>]]
Probably as a subgroup at the bottom of "Temperature", or maybe its own group with the heading "Thermal expansion" below "Temperature". Honestly, I don't see much use of the "per degree Celsius/Fahrenheit/Rankine" ones, but I threw them in for completeness' sake. But K−1 is the SI unit for thermal expansion; it'd be nice to have it available. — sbb (talk) 00:01, 16 October 2026 (UTC)
- I added K-1 in its own "Thermal expansion" section to document what it is. The others should use "degC" etc. for consistency and easy typing. I didn't add them as I don't think items should be added unless they are going to be used in multiple places. Johnuniq (talk) 00:56, 16 October 2026 (UTC)
- Thanks. Yeah, I wasn't really wedded to the others. K−1 is already uncommon enough, I doubt the others would get much use. — sbb (talk) 01:32, 16 October 2026 (UTC)
Edit request 30 October 2026
[edit]This edit request has been answered. Set the |answered= parameter to no to reactivate your request. |
Description of suggested change: Please add the decibel (dB) to the list of units supported by Template:Val. The decibel is a widely used logarithmic unit for expressing ratios, particularly in acoustics, electronics and telecommunications. Although it is not an SI unit, it is accepted for use with the SI. Adding it would allow editors to use the unit code dB with the template and provide a direct link to the relevant article.
Diff:
| − | nat [[Nat (unit)|nat]] | + | nat [[Nat (unit)|nat]]dB [[Decibel|dB]] |
--Carnby (talk) 23:13, 30 October 2026 (UTC)
- Done. Johnuniq (talk) 03:28, 31 October 2026 (UTC)