Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6604963

Assigning float value to int and long throws invalid type exception.

XMLWordPrintable

    • b07
    • generic
    • generic

        Snip of Jim's e-mail.

        Jim wrote:

        here is what I found for setting different float vals
        into each primitive type:
                     1.2345 1234.1 70000.1
        bool exc exc exc
        byte no exc exc exc
        char no exc no exc exc
        short no exc no exc exc
        int exc exc exc
        long exc exc exc
         
        So:
        - bool is handled ok
        - byte, char, short are handled ok with your interpretation that
          just losing precision is ok
        - int and long seem to be broken. There should be no exceptions
          in any of the above for int and long, shoult there?

              dtitov Daniil Titov (Inactive)
              swamyv Swamy Venkataramanappa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: