jscience
  1. jscience
  2. JSCIENCE-57

Need units simplification in calculations

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: Version 6.0
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      57

      Description

      Currently dimensionless units such as [ms/s] are not simplified in calculations.
      This can lead to thrown exceptions during complicated calculations, for example:

      > Amount<Velocity> vel = Amount.valueOf(20.0, SI.METER_PER_SECOND);
      > Amount<Duration> t1 = Amount.valueOf(1.0, SI.MILLI(SI.SECOND));
      > Amount<Length> l = Amount.valueOf(2.0, SI.METER);
      > Amount<Length> len = (Amount<Length>) vel.times(t1).times(l).root(2);
      > System.out.println( "len = " + len );

      The result of this is:

      > len = (6.324555320336756 ± 2.2E-15) m·ms^1:2/s^1:2

      and any attempt to use the resulting "len" variable throws a
      ConversionException: s holds a base unit with fractional exponent.
      The [ms/s] unit should be simplified prior to the square root.

      I'm not sure what the solution to this problem is, but I am hoping that this
      request will stimulate some suggestions.

      Thanks,
      -John

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            jscience-issues
            Reporter:
            johnranderson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: