sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Desruisseaux (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SIS-120) AngleFormat: Missing minus sign when the degrees field is zero
Date Tue, 13 Aug 2013 13:33:47 GMT
Martin Desruisseaux created SIS-120:
---------------------------------------

             Summary: AngleFormat: Missing minus sign when the degrees field is zero
                 Key: SIS-120
                 URL: https://issues.apache.org/jira/browse/SIS-120
             Project: Spatial Information Systems
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 0.3
            Reporter: Martin Desruisseaux
             Fix For: 0.4


When formatting a small angle with {{AngleFormat}}, if the angular value is smaller than 1°,
then the minus sign is missing. For example formatting 0.1° currently produces {{0°06′}}
while we expect {{-0°06′}}.

The problem appear in the following line:

{code:java}
degrees += correction;
{code}

The problem is that in the Java language, {{-0.0 + 0 == +0.0}}. The fix is to explicitly check
for zero value.

{code:java}
if (correction != 0) {
    // Really need the check for 0 value in order to preserve the sign of negative zero.
    degrees += correction;
}
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message