jscience
  1. jscience
  2. JSCIENCE-116

Real.valueOf(CharSequence) does not work for -0.XXX

    Details

    • Type: Task Task
    • Status: Open
    • Priority: Critical Critical
    • 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:
      116

      Description

      If you give values to Real.valueOf(CharSequence) that start with -0. the answer
      is positive. This is since the value before the decimal point is interpreted as
      an integer and is checked later for being negative - which does not work if it
      is zero. A consequence is that the same error appears at
      FloatingPoint.valueOf(CharSequence) as well.

      To fix this one can insert the following 3 lines at the start of the function:
      if ('-' == chars.charAt(0))

      { return valueOf(chars.subSequence(1, chars.length())).opposite(); }

        Activity

        Hide
        hstoerr added a comment -

        This should be a patch instead of an issue, since I included a fix.
        Tests to verify the fix are included in issue 120.

        Show
        hstoerr added a comment - This should be a patch instead of an issue, since I included a fix. Tests to verify the fix are included in issue 120.

          People

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

            Dates

            • Created:
              Updated: