W3C home > Mailing lists > Public > www-style@w3.org > June 2006

Formatting Numbers

From: fantasai <fantasai.lists@inkedblade.net>
Date: Tue, 13 Jun 2006 15:32:32 -0400
Message-ID: <448F12D0.1040108@inkedblade.net>
To: www-style@w3.org

There was some interesting discussion about number formatting on the WHATWG list
that I thought should be forwarded here.

~fantasai

-------------------------------------------------------------------------------------

http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2006-June/006530.html

Keryx webb wrote:
> 
> Hello
> 
> My first post to this list and since I'm mainly lurking to learn, this will be 
> simple.
> 
> I have personally (and currently) no need to write any advanced mathematical 
> formulas, but would like to have simple but large numbers formatted in an usable 
> and accessible way.
> 
> If I write 54367534196.143 it is hard to read. In English this would be easier 
> for most users:
> 54,367,534,196.143
> 
> In Swedish we write it this way:
> 54 367 534 196,143
> 
> However, there are two problems.
> 
> 1. The number might be split across two lines (bad usability):
> ... yadda yadda yadda 54 367
> 534 196.143
> 
> 2. The number will not be spoken correctly using speech synthesis (bad 
> accessibility for some). Instead of "54 billion 367 million 534 thousand 196 
> point 143" it would probably say:
> 54
> 367
> 534
> 196,143
> 
> The first problem is easily remedied. Wrap in a span and apply CSS "white-space: 
> nowrap" or (not quite as elegant) use non-breaking space.
> 
> There are issues also with i18n. What is needed is some CSS rule that can be 
> used in a similar fashion to XSLT's format-number() or (dare I say it) 
> mso-number-format. If UAs knew that they dealt with a number, they might infer 
> from the current language what separates decimals from integers. Using selectors 
> for language and mediaspecific styles we could have numbers easily readable for 
> all sighted users and easily understood by blind users as well.
> 
> Lars Gunther

------------------------------------------------------------------------------------

http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2006-June/006531.html

Michel Fortin wrote:

> Le 6 juin 2006 à 6:37, Keryx webb a écrit :
> 
>> The first problem is easily remedied. Wrap in a span and apply CSS  
>> "white-space: nowrap" or (not quite as elegant) use non-breaking  
>> space.
> 
> Have you tried using unbreakable spaces instead?
> 
>     123&nbsp;456&nbsp;789,12
> 
> I'm curious to know if a screen reader can read that correctly.
> 
>  - - -
> 
> Maybe a number element would be valuable, both inside and outside  
> formulas, to provide format-neutral machine-readable numeric values:
> 
>     <n value="123456789.12">123 456 789,12</n>
> 
> But it surly seems a little overkill to write each numeric value  
> twice. Duplicating values seems prone to errors. So maybe a number  
> with a decimal separator attribute would be a better approach:
> 
>     <n dec=",">123 456 789,12</n>
> 
> Beside that, it could provide data on other kinds of numbers too:
> 
>     <n base="16">329F 2CA0</n>
> 
> 
> Michel Fortin
> michel.fortin@michelf.com
> http://www.michelf.com/

-------------------------------------------------------------------------------------

http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2006-June/006542.html

Mihai Sucan wrote:

> Le Tue, 06 Jun 2006 17:22:11 +0300, Michel Fortin a écrit:
> 
>> Maybe a number element would be valuable, both inside and outside  
>> formulas, to provide format-neutral machine-readable numeric values:
>>
>>      <n value="123456789.12">123 456 789,12</n>
>>
>> But it surly seems a little overkill to write each numeric value twice.  
>> Duplicating values seems prone to errors. So maybe a number with a  
>> decimal separator attribute would be a better approach:
>>
>>      <n dec=",">123 456 789,12</n>
>>
>> Beside that, it could provide data on other kinds of numbers too:
>>
>>      <n base="16">329F 2CA0</n>
> 
> Hello!
> 
> I'd look for a solution via CSS. It is not possible today, but I'd say  
> this would be a welcome addition.
> 
> I like the idea Michel came up with. However, with a few changes. Yes, the  
> value attribute would be overkill.
> 
> Similar to the way you can define quotes in CSS, I'd wish we could be able  
> to define number format.
> 
> <n base="16">329F 2CA0</n>
> <n base="10" dec=".">12672611872.7889</n>
> 
> and from CSS:
> 
> number-format: base group-char decimal-char;
> 
> number-format: 32 " " ".";
> number-format: 2 none ",";
> 
> So, from HTML you define the format in which you provide the number. Then  
>  from CSS you can change the base used for displaying, the chars to be used  
> for grouping digits and for separating the decimals.
> 
> Both attributes are optional. The dec attribute defines the char used for  
> separating the decimals (making it easier for the UA to convert the number  
> to the new number-format set by CSS).
> 
> This way we provide a fall back mecanism for browsers with no support for  
> <nr> and the CSS property. CSS 3 Math module would be appropriate for  
> adding such a property.
> 
> Also, this discussion would probably better fit into www-style mailing  
> list. Or ... maybe someone is interested in having this added to HTML 5.
> 
> -- 
> http://www.robodesign.ro
> ROBO Design - We bring you the future

------------------------------------------------------------------------------------
Received on Tuesday, 13 June 2006 19:32:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:45 GMT