Hello. This looks like an anomaly to me. Parameter |ul= with MB/s is supported with a reasonable link, but MB just points to a disambiguation page:
|ul=
MB/s
MB
Could this be easily rectified for B, kB, MB, GB, and TB? Best wishes. RobbieIanMorrison (talk) 19:45, 2 January 2017 (UTC)
B
kB
GB
TB
12.3 [[Megabyte|MB]]
{{val|12.3|u=[[Megabyte|MB]]}}
{{val|12.3|ul=byte/s}}
{{val|12.3|ul=kB/s}}
{{val|12.3|ul=MB/s}}
{{val|12.3|ul=GB/s}}
{{val|12.3|ul=TB/s}}
|u=
12.3{{nbsp}}[[Megabyte|MB]]
There are times when the number of trailing significant digits cannot readily be given through the input value string to template val. Would it be possible to support a parameter specifying this? I'm thinking of is where the parameter is generated, e.g. via #expr, which deletes trailing zeros. Or better: is there some way to force #expr's output on the round operation to include zeros to the specified rounding precision? —Quondum 18:54, 4 February 2017 (UTC)
#expr
|1=1.256e-5
|least=-10
|least=-6
1.23456789e-5
least
e
{{val|10.00|least=1}}
sortable=on
least=-3
round=3
decimals=3
{{val|1.23456|round=3}}
{{val|1.23456e-5|round=3}}
{{val|1.2|round=3}}
{{val|1.2e-5|round=3}}
#expr:
|1={{#expr:1e4}}
|1=10000
round
|e=
{{val|1234.5|round=-2}}
{{#expr:1.2345e-30 round 32}}
{{val|{{#expr:1.2345e-30 round 32}}}}
{{val|{{#expr:1.2345e-30}}|round=32}}
{{val|1.2345e-30|round=32}}
decimals=2
{{val|1.2345e-30|decimals=2}}
decimals
{{#expr:0.000100}}
{{#expr:0.000099}}
|decimals=1
decimal
|1=
|decimal=
{{val|2.41235e3|decimal=1}}
{{val|2412.35|decimal=1}}
{{val|2.41235e3|decimal=1|e=-20}}
{{val|2412.35|decimal=1|e=-20}}
Request withdrawn: there is a better way to achieve this in the context where I needed it. For example, replace {{val|{{#expr:1.2985round2}}}} → 1.3 with {{val|{{decimals|1.2985|2}}}} → 1.30. —Quondum 01:00, 10 February 2017 (UTC)
{{val|{{#expr:1.2985round2}}}}
{{val|{{decimals|1.2985|2}}}}
In the example {{Val|11|ul=kg.m|upl=s-2}} → 7002107873150000000♠11 (kg·m)/s−2, where the numerator of the units does not contain a division (only multiplications), parentheses around the numerator are superfluous as there is no ambiguity, but they do produce visual clutter. Shouldn't Val refrain from adding parentheses in this context? —Quondum 21:10, 10 February 2017 (UTC)
{{Val|11|ul=kg.m|upl=s-2}}
{{val|1|u=kW.h|up=s}}
|upl=
{{val|1|u=J.kg-1.K-1}}
{{val|1|u=V.s/(A.m)}}
{{val|1|u=[[Gray (unit)|Gy]].[m]/(A.[s]2)}}
I just realized that
{{val|10|ul=pb}}
Yields 10 pb, rather than 10 pb. These units (and their inverse, like 10 fb−1) are routinely used in nuclear and particle physics. We certainly don't need the whole gamut of SI prefixes, but barns, milli/micro/nano/femto/pico barns and their inverse should all be supported. Headbomb {t · c · p · b} 15:42, 28 June 2017 (UTC)
pb
ul=pb
{{val|123|ul=fb-1}}
{{val|123|ul=b}}
{{val|123|ul=Mb}}
{{val|123|ul=pb}}
To use template {{val}} within the {{Infobox}} of article Samsung Galaxy S8, I have quickly added many units as bits, bytes, kB, dpi...
But to check my understanding I published my change, and then published many times erroneous content, sorry.
I do not know if my latest version is correct because Template:Val/list does not seem to be updated :-/
Please review my changes and for next time tell me how to preview Template:Val/list while editing Module:Val/units.
I have (at least) three issues in my change:
Thanks --Oliver H (talk) 19:48, 9 July 2017 (UTC)
User:Johnuniq/sandbox
pitch
{{convert|1000|pitch}}
{{val|12|u=widgets}}
{{val|12|ul=widgets}}
{{val|12|u=[[Example|widgets]]}}
{{val}}
{{convert}}
I have finally had time to examine the recent edits. Defining units may be a bit more tricky than it appears. Any future work should occur in Module:Val/units/sandbox and should be tested with {{val/sandbox}}. After finding a couple of problems with the recent edits I decided to revert them as requiring more planning. Examples of problems:
Also, please do not add units that might be useful. There probably is no need for the unit, and more of them just makes clutter and overhead. Johnuniq (talk) 04:54, 27 July 2017 (UTC)
Some additions to the units supported by val have been proposed at the module talk. The discussion started as a question about the modules, but now many new units such as Kibit have been added so anyone interested might like to comment. Johnuniq (talk) 04:09, 14 July 2017 (UTC)
I notice that the units string H.m-1 yields middot instead sdot, whereas all the other units seem to produce sdot. Could this case please be made uniform with the rest?
Also, supporting the input string "kW·h" (using a middot) is pointless; I suggest just removing this. Anywhere it is used will display an error and quickly get fixed (it only needs replacement by the supported string "kW.h"). Supporting nonstandard input string compositions is a slippery slope towards a maintenance nightmare (think in terms of the number of strings supported being exponential in the input variations supported, so root them out before they get established). —Quondum 03:18, 30 October 2017 (UTC)
I added TemplateData for some parameters. I cannot quite test what I did, as the TemplateData information seems to still not be active. I wonder how long time has to pass before it will be active? I did purge Template:Val and Template:Val/doc, with no effect. --Jhertel (talk) 19:43, 17 November 2017 (UTC)
When I created the original {{val}}, I used {{FormattingError}} to report errors, which show a big red warning on the page if you make an error. I believe the port to LUA may have remove that in favor of another smaller, dark blue error message. This new error message is very hard to notice. Subsequently, I've seen a lot of editors introducing errors without noticing, especially when making a large number of changes to a complex page. Can we please start using {{FormattingError}} again so the errors are easier to notice? If not, can we please remove mention of that template from the documentation and delete the template as it would be superfluous? I would do this myself, but I haven't the time nowadays. — SkyLined (talk) 23:36, 30 December 2017 (UTC)
{{val|1|2|3}}
{{val|1|2|3|4}}
{{val|1|u=m|ul=m}}
{{tl|val|4|u=m}}
{{tl|val|4u=m}}
{{val|1.2e6|unit=m}}
And now a question from someone with inadequate coding skills: What does Template:Hearts have to do with Template:Val documentation, or, that is, why is Template:Hearts being called in the wikitext below (which is what I see when I click "View source")? And why might Template:Val need this but Template:Gaps not need it?
<includeonly>{{{{{♥|safesubst:}}}#invoke:val|main}}</includeonly><noinclude> {{documentation}} </noinclude>
Thanks. Quercus solaris (talk) 20:16, 24 February 2018 (UTC)
{{subst:val|123|2|3|=done}}
=done
I plan to remove all warnings and replace them with errors as discussed here unless someone can provide a good reason not to. In short: these warnings are often overlooked by editors, which cause the pages in which they are introduced to contain incorrect information until somebody notices and fixes it. Over the past few weeks this has happened about once every two weeks and it can take up to a week for somebody (other than me) to notice and fix it. By replacing these hard-to-notice warnings with clearly visible errors, I expect editors to detect and fix their mistakes themselves almost immediately and prevent Wikipedia from having incorrect information up to half the time. Unfortunately, I have little time at the moment and no working knowledge of LUA, so I cannot commit to a date for this change at this point. If you are able to make this change, I would appreciate if you would go ahead and do so at your earliest convenience. — SkyLined (talk) 11:06, 14 February 2018 (UTC)
Unicode   for Narrow Non-Breaking Spaces is now well-supported by browsers. This is typographically a better option than ( ) whose spaces look too wide for digit grouping and for separating digits from unit abbreviations. https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Dates_and_numbers#Numbers currently says "Digits should be grouped and separated either by commas or by narrow gaps". What do people think about changing the Val template to use   characters which are narrow gaps? Testing:
8876 generated by 8876
8,876 generated by 8,876
8 876 generated by 8 876
8 876 generated by 8{{nbsp}}876
8 876 generated by 8 876
8 876 generated by 8{{nnbsp}}876
Jaa101 (talk) 04:37, 15 March 2018 (UTC)
{{val|12345678.901234}}
Could this template support this input improvement?
12 x 12 m3
12 × 12 m<sup>3</sup>
It is about keyboard input into well-formatted MOS output. -DePiep (talk) 01:03, 18 March 2018 (UTC)
A nice thing about acepting e notation is that the output of {{#expr:}} can be fed straight into {{val}} for pretty-printing. However, there's one little issue:
{{#expr:}}
{{Val|{{#expr:2^64 round -13}}}}
{{Val|1.844674E+19}}
Is there an easy way to get rid of that ugly + sign in the exponent? Do I have to use {{#invoke:String|replace|{{#expr:...}}|+}}? 23.83.37.241 (talk) 07:06, 3 May 2018 (UTC)
{{#invoke:String|replace|{{#expr:...}}|+}}
{{val|1.23E45}}
{{val|1.23E+45}}
{{valexpr}}
{{scinote}}
{{scinote|1.23E+45}}
Hello, I'm from de.wikipedia and have copied the module val. It functions quite well there but in German (and Italian,...) Wikipedia the decimal separator should be a comma. What lines must be changed to adapt only the output, so that {{val|2.44|u=kg}} is displayed as 2,44 kg? --Nov3rd17 --Nov3rd17 (talk) 12:10, 23 June 2018 (UTC)
Specifically something like:
1,234 ±567
Nergaal (talk) 16:27, 20 July 2018 (UTC)
1,234<br>±567
Thin spaces for use with SI number formatting are represented via this template as a quarter of an em (incorrect) rather than a fifth of an em (correct). Excelsiorsbanjo (talk) 18:27, 6 September 2018 (UTC)
This spacing is not directly addressed at MOSNUM, so conformance and nonconformance both are likely technically impossible at present. It does indirectly address it, however, in the WP:MOSNUM#Grouping_of_digits section (under 'Grouping with narrow gaps'), where it correctly refers to utilizing (screen reader issues aside) a thin space, as specified by the SI Brochure. A thin space as defined by our own article, web browsers (which implement the character), and just about any source you will find is a fifth of an em, not a quarter. Excelsiorsbanjo (talk) 01:46, 7 September 2018 (UTC)
 
{{gaps|123|456|789|012}}
{{val|123,456,789,012}}
{{gaps|123|456|789|012}} <span style="white-space:nowrap">123<span style="margin-left:0.25em">456</span><span style="margin-left:0.25em">789</span><span style="margin-left:0.25em">012</span></span> {{val|123,456,789,012}} <span class="nowrap"><span style="display:none" class="sortkey">7011123456789012000♠</span>123<span style="margin-left:.25em;">456</span><span style="margin-left:.25em;">789</span><span style="margin-left:.25em;">012</span></span>
Here is the relevant text of the 9th CGPM: https://www.bipm.org/utils/common/pdf/CGPM/CGPM9.pdf#page=70 As far as I can tell it does not mention a "thin space" explicitly as the supposedly translated-from-the-French English text does, which is bafflingly disappointing. You can tell, however, from this reproduction and those of other years that the intended width of the space (at least as implemented by the authors of the time) was incredibly thin indeed (the OCR is not great for these PDFs, but if you search for '000' you will find numerous examples of large numbers with digits grouped in threes), and that the intent was clearly for the spacing to be thinner than as used between regular words. As for a general comparison alone, the numbers as formatted by this template are incredibly hard to read, IMO, because of the quite large spacing, but the numbers as formatted in the CGPM documents from around 1948 (9th CGPM) until fairly recently, with their thinner spacing, are far more readable. Excelsiorsbanjo (talk) 00:22, 10 September 2018 (UTC)
When I first saw a number with uncertainty on the form 1.357543(20), I did not understand what that "(20)" meant. Even though I studied math in my engineering studies some decades ago, I don't remember seeing that notation. After looking at the citation I found out what it meant, but I wanted to add a link from the "(20)" part (the uncertainty part) to an article about uncertainty so readers can easily click that to learn the notation and read more about uncertainty and different notations for it. But as the number with the uncertainty was created with this template, that was easier said than done. I don't think there is a way to do that with this template, is there? The problem is vaguely similar to linking from units; it shouldn't always link, to prevent overlinking. But I guess it could be solved by adding a parameter that you can give a value for the name of an article that should be linked to from the uncertainty part. Or it could be a boolean parameter whether to link our not to a fixed article about uncertainty. If such a parameter doesn't already exist? --Jhertel (talk) 02:56, 23 November 2018 (UTC)
Why does this template use another template ♥? – Sivizius (talk) 01:46, 1 December 2018 (UTC)
There is a discussion at the Template:val talk page about the width of the space between digit groups. The module currently uses 1/4em but it seems most external sources suggest using 1/5 or 1/6em. I support this change for that reason. I was looking at how I might implement it when I noticed that the module currently uses an empty <span> element with a 0.25em width to add the spaces. This seems overly complex and the code does not provide a reason for this. If I am correct and there is no good reason, I suggest we replace this <span> element with a Unicode &thisp;. — SkyLined (talk) 08:16, 7 September 2018 (UTC)
The SI guide (NIST Special Publication 811 – 2008 Edition) well-nigh mandates the format for quantities with uncertainties, giving as example
It is essentially impossible to achieve the second recommended example using {{val}} with a unit but without a decimal exponent (with an exponent, parentheses are automatically generated), getting
I suggest that {{val|63.2|0.1|u=m}} (i.e. whenever parameters 2 and u are both present) should automatically generate (63.2 ± 0.1) m, in line with the SI. I have just added this example to MOS:UNCERTAINTY, so let's see whether it kicks up a firestorm. —Quondum 01:01, 28 February 2019 (UTC)
{{val|63.2|0.1|u=m}}
Hello, I would like to importo this module to it.wiki, but currently there are not localization options like for Module:Convert. I could try to move error message and some formatting options (like the decimal separator) to an external module (Module:Val/locale). Do you think this could be useful or they are reasons (performance Ithaquabe?) not to do this?Moroboshi (talk) 07:53, 3 June 2019 (UTC)
formatnum
if numdot ~= '.' then arg = arg:gsub(numdot, '.') end
%s
"
"
lbf
year
Per a discussion at Template talk:Convert#Switching from hidden sort keys to data-sort-value, {{convert}} is changing the format of sort keys. {{val}} gets its sort keys from convert so val will change as well. The following shows some val templates and the output from Special:ExpandTemplates.
{{val/sandbox|12.34}} <span class="nowrap"><span data-sort-value="7001123400000000000♠"></span>12.34</span> {{val/sandbox|12.34|sortable=debug}} <span class="nowrap"><span data-sort-value="7001123400000000000♠"><span style="border:1px solid">7001123400000000000♠</span></span>12.34</span>
This will be live in {{val}} in due course. Let me know if there is a problem! Johnuniq (talk) 10:41, 21 April 2019 (UTC)
{{val|400|-|500}}
-data-sort-value
-data-sort-value-ascending
-data-sort-value-descending
Is it possible to have the unit name returned ("second" not "s")? -DePiep (talk) 20:19, 20 September 2020 (UTC)
abbr=off
{{val|123|u=seconds}}
{{val|12345|67|89}}
I'd like to add bit and byte unit conversions, e.g. between kilobytes and megabytes etc., to Template:Convert. I saw that Template:Val has entries for kB, MB, GB, and TB (but none for or other multiples), as well as a couple of data rates, e.g. Mbit/s. Will we have to move them? I don't quite understand the relation between Val and Convert. Looking forward to your comments at Template talk:Convert#Bits and bytes. Thanks! -- Chrisahn (talk) 11:27, 13 October 2020 (UTC)
How do we format (A×B×C)±y ? I don't see anything in the guideline. I put the uncertainty in the units param, but that's not ideal. — kwami (talk) 00:25, 25 October 2020 (UTC)
x
{{val|568|x|532|x|448|u=±12 km}}
{{val|568|by|532|by|448|u=±12 km}}
Thanks. I thought we used to be able to do that directly. Maybe misremembering. — kwami (talk) 00:58, 25 October 2020 (UTC)
Is there any reason that the following cases aren't documented by examples?:
On the other hand, what is the point of:
When would that be meaningful and useful? I would be bold and simply change these, but the page is protected. --Macrakis (talk) 21:20, 3 February 2021 (UTC)
It appears that unit "%" is treated differently:
{val|3.45|(23)|e=2|u=kg}
{val|3.45|(23)|e=2|u=%}
A workaround is |s=%
|s=%
{val|3.45|(23)|e=2|s=%}
-DePiep (talk) 14:50, 22 April 2021 (UTC)
I've tried applying {{val}} to Solar wind article, and I have the following ideas:
{{val|e=5|u=K}}
{{val|e5|u=K}}
{{val|1e5|u=K}}
{{val|p=~|300|u=km/s}}
{{val|~300|u=km/s}}
{{val|70-85|u=K}}
{{val|70|-|85|u=K}}
{{val|70|and|85|u=K}}
{{val|12-14|e6|u=AU}}
{{val|12-14|e=6|u=AU}}
{{val|500|km/s}}
{{val|500|u=km/s}}
{{v}}
These changes would allow users to write very easy expressions like {{v|500|km}}, {{v|±3|mm}}, {{v|≈30000}}, {{v|20-30|m/s}} when they need non-breaking spaces, proper formatting of big numbers, automatic en dash for ranges, and automatic sort key. Simplicity of use and clarity of syntax will significantly increase the usage of the {{val}} template, which will result in better, more uniform formatting of scientific notation across Wikipedia. --46.242.12.2 (talk) 17:36, 3 August 2019 (UTC)
{{v|500|km}}
{{v|±3|mm}}
{{v|≈30000}}
{{v|20-30|m/s}}
{{10^|5}}
|p=~
p
e5
1e5
Powers of the angstrom are not supported by default, which is problematic when specifying the unit cell volume in {{Chembox Structure}}.
{{val|1215.8|(5)|u=Å3}}
{{val|1215.8|(5)|u=Å<sup>3</sup>}}
Actually, I think that all units should have automatically supported dimensions for such weird things as "m/s3". –LaundryPizza03 (dc̄) 08:47, 14 June 2021 (UTC)
Won't be happening because it violates some policy, or you know if a reason why it's technically impossible? Or won't be happening if you are the person who has to implement it? I'm not volunteering to do it, just want to know if there's a technical reason or a personal one. — SkyLined (talk)
{{val|1|ul=Tb/s}} (1 Tb/s) links to Data-rate_units#Gigabit_per_second. Data-rate_units#Terabit_per_second would be more appropriate. ~Kvng (talk) 19:27, 30 September 2021 (UTC)
A recent edit by Kwamikagami changed the symbols for Earth mass and radius. Following is an example from Moon#Formation without the refs. Old shows the original symbol, and New shows the correct symbol matching Earth radius, although it is just a smudge on my system.
I'm noting this for anyone interested because I think there was discussion about the symbol but I can't find it. Johnuniq (talk) 01:29, 8 October 2021 (UTC)
What my "idea" is
In some cases
{{val|14|u=MK}}
{{val|10|u=MK}}
The line .. (currently, line number 301, iirc) .. that says
MK [[Megakelvin|K]] SI
results in a hyperlink pointing to "Megakelvin" ... which is a"Redirect page,"pointing to
Orders of magnitude (temperature)
. I havean ideafor changing that line.
I was hoping to be able tobypassthat redirect page, by editing the above mentioned line ... (line number 301, "as of" the last time I checked) ... to change it from
to
MK [[Orders of magnitude (temperature)|K]] SI
The reason why I wanted to do that
My reasoning was ... that even though I could (maybe) havefigured outthat "MK" means Megakelvin [units] ... I did not want to have to click on that hyperlink in order to confirm my suspicions. (Call me lazy, but ... if I am lazy, then ... perhaps that situation was aided and abetted by .. the fact that Wikipedia offers those convenient little "preview" displays, -- ! -- when I "hover" my "mouse" pointer over a certain displayed hyperlink.) Asyou may already know!,-- those cool little "preview" displays work OK when there is NOT a redirect involved, but ... when there*is*a redirect, then ... they do not exactly work. (One would have to actually "click".)
Any comments?
Would that (suggested change) be OK?
* * * Thanks * * * for listening. --Mike Schwartz (talk) 18:06, 29 September 2020 (UTC)
{{val|10|ul=MK}}
The current use of the Circled Plus (⊕, U+2295) to represent the Earth symbol for the Earth radius and Earth mass units (R⊕ and M⊕) is not the intended use of this character. This character only has the aliases of "direct sum" and "vector pointing into page"[1] with the alias of "early astronomical symbol for earth" instead given to the Alchemical Symbol For Verdigris (🜨, U+1F728)[2]. Using this would give R🜨 and M🜨. It's true that the proper character has poorer support because it was added to the standard in 2010 while the Circled Plus was added way back in 1993 but the lookalike has its own display issue in that some fonts may display the plus sign as not reaching the edge of the circle[3] and so will end up displaying something that isn't actually visually identical to the Earth symbol. Note that any change should also be applied to Template:Earth mass. NuclearElevator (talk) 05:19, 13 October 2020 (UTC)
References
Hi there! I'd like to use the Wikiversity version of Val, but it's outdated. Usage that works on Wikipedia doesn't work on Wikiversity. Would anyone be available to help with an update? Since this template relies on a module, and since I don't want to break existing pages that use the template, I thought someone here who is more familiar with the code might be able to do this more quickly, or provide guidance on how best to proceed. Any assistance would be appreciated! --Greg at Higher Math Help (talk) 08:02, 24 March 2022 (UTC)
|answered=
Can we add an ips unit for Inches per second? ~Kvng (talk) 17:09, 17 May 2022 (UTC)
{{val|1.23|u=ips}}
{{val|1.23|ul=ips}}
Can we change the displayed symbols for both |u=μN and |u=μB to italicize the mu (i.e., to display μN and μB rather than μN and μB)? The mu in these instances, unlike the mu in the unit μm or in the particle symbol for muon (μ− and μ+), is a symbol for a quantity (similar to c, kB, and countless others), which by WP convention is italicized, even when a fundamental constant. See, for example, the formatting at the associated articles linked by this module, namely Nuclear magneton and Bohr magneton. 172.82.46.195 (talk) 20:04, 27 June 2022 (UTC)
|u=μN
|u=μB
{{val|10.6|ul=µB}}
|ul=µB
|u=µB
insource:
{{val|ul=μB}}
{{val|ul=µB}}
{{val|ul=μN}}
{{val|ul=µN}}
@IP: Thanks for fixing Holmium (diff in case needed elsewhere). Searching articles with hastemplate:val insource:µB and hastemplate:val insource:µN does not find any occurrences so I have removed units µN and µB. Johnuniq (talk) 03:23, 30 June 2022 (UTC)
hastemplate:val insource:µB
hastemplate:val insource:µN
Could we add units for temperature, in units of eV/kB (and its common multiples)? I imagine the following would suffice:
eV/c2 [[Electronvolt#Temperature|eV/''k''<sub>B</sub>]]
keV/c2 [[Electronvolt#Temperature|keV/''k''<sub>B</sub>]]
MeV/c2 [[Electronvolt#Temperature|MeV/''k''<sub>B</sub>]]
GeV/c2 [[Electronvolt#Temperature|GeV/''k''<sub>B</sub>]]
TeV/c2 [[Electronvolt#Temperature|TeV/''k''<sub>B</sub>]]
As an example use, in Higgs boson, "when the universe was at a temperature 159.5±1.5 GeV" would more correctly be expressed as "when the universe was at a temperature 159.5±1.5 GeV/kB" 172.82.46.195 (talk) 22:00, 2 August 2022 (UTC)