Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: jscience-issues
Reporter: rcasha
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Mathematical error in calculating compound values

Created: 15/Apr/09 07:54 AM   Updated: 31/Jan/11 02:48 AM
Component/s: www
Affects Version/s: current
Fix Version/s: Version 6.0

Time Tracking:
Not Specified


Operating System: All
Platform: All

Issuezilla Id: 135
Participants: jscience-issues and rcasha

 Description  « Hide

The technique for converting decimal degrees into degrees-minutes-seconds does
not work correctly (gives wrong figures).

eg: 35.857497 should convert to 35°51'27, but instead produces 35°50'26"

This might be some rounding error.

Sample Code:
package test;

import java.math.BigDecimal;
import javax.measure.DecimalMeasure;
import javax.measure.quantity.Angle;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import static javax.measure.unit.NonSI.*;

public class TestDMS {

public static final Unit<Angle> DMS =

public static void main(String[] args) { DecimalMeasure<Angle> v1 = new DecimalMeasure<Angle>(new BigDecimal("35.857497"), NonSI.DEGREE_ANGLE); System.out.println(v1); DecimalMeasure<Angle> v2 =; System.out.println("actual = "+v2); System.out.println("expected = 35°51'26.99\""); }

I'm re-posting this here since it's the first bug in project JSR-275 and I don't
know if there's anyone watching that one.

There are no comments yet on this issue.