Page MenuHomePhabricator

floating point numbers
Closed, InvalidPublic

Description

Author: lmout1982

Description:
The decimal separator have an additional space like this: “5 .48652” (5 .48652 in the page source code). The plain format has no effect.

The problem can be viewed online at: http://wiki.culture-langues-lorraine.org/Test

Version of SMW used: 1.4.2
Version of MW used: 1.15.1
Server setup used: PHP 5.2.6 (cgi), MySQL 4.0.27
The problem is not reproducible on a test page on the sandbox site.


Version: unspecified
Severity: normal

Details

Reference
bz20285

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:52 PM
bzimport set Reference to bz20285.

Refreshing the page ("purger" tab) fixed the problem for me (not being logged in). I am not sure what could have cause the bug in the first place. Please let us know if it should reappear. The plain format was not available in SMW 1.4.2 yet, so its not surprising that it has no effect.

jm.bugtracking wrote:

I'll dare to reopen this bug, as I can confirm it.

A property with [[Has type::Number]] will render a floating point value like this "4 .321", because ".321" will be interpreted as the value's unit. I encountered this while working with Ontoprise's triple store where these values will be returned as "http://www.w3.org/2001/XMLSchema#unit" instead of the correct "http://www.w3.org/2001/XMLSchema#double".

Appending a zero "4.3210" will sometimes fix the issue.

jm.bugtracking wrote:

I confirmed this on SMW 1.4.3 / MW 1.15.1 btw.

I understand the problem now. Some languages use "." as a decimal separator while others use ",". In some languages, one of "." and "," is furthermore accepted as a(n optional) separator for thousands. In other languages, the separator for thousands is only space, and no other symbols is allowed. Therefore, it is important to use the right input syntax for the language setting. Unfortunately, it is not possible to support all syntactic forms that are used internationally for numbers at once since there are cases where the value is ambiguous across languages. Here are some examples:

  • 4,123 in English is a number above four thousand
  • 4.123 in English is the number four with a fraction
  • 4,123 in German is the number four with a fraction
  • 4.123 in German is a number above four thousand
  • 4,123 in French is the number four with a fraction
  • 4.123 in French is not a number, since "." is not understood in French numbers. Hence SMW falls back to considering the unclear part of the input as a unit, so the value becomes the number four in the unit ".123".

You can see the values of "MediaWiki:smw_decseparator" and "MediaWiki:smw_kiloseparator" for finding out what the respective syntactic conventions are for your language. You can also change the values locally if you find that, for some reason, the users of your French or German wiki write numbers in English.

This explains the unwanted display. Adjust your writing to your language, or vice versa to fix the problem. If you think that the localisation of number parsing to some language is wrong, then this would be a bug in the SMW translation that can be fixed on translatewiki.net.