Shop OBEX P1 Docs P2 Docs Learn Events
Error "Unsupported float or long operation" — Parallax Forums

Error "Unsupported float or long operation"

AjenjoAjenjo Posts: 5
edited 2007-05-11 10:31 in General Discussion
Greetings.

I will explain you my problem with the attached source.

The source compile correctly, but Javelin show me the error "Unsupported float or long operation" when I click on Debug and It happends although the source have a few lines in its main class (it's the example that I give you). This happends if I have the wire connect to the robot, or if it isn´t connect, or if I remove the .class and I generate it again...

I've been doing more things but I didn´t work and I can´t find the solution anywhere.

Waiting some help.


Thanks so much.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-05-11 08:09
    In file tablas.java

    change

    ······· // Método que devuelve las coordenadas del conjunto difuso
    ······· public double getCoordenadas(int conjuntoDifuso, int coordenada) {
    ··············· return (this.coordenadas[noparse][[/noparse]conjuntoDifuso][noparse][[/noparse]coordenada]);
    ······· }

    into
    ······· // Método que devuelve las coordenadas del conjunto difuso
    ······· public int getCoordenadas(int conjuntoDifuso, int coordenada) {
    ··············· return (this.coordenadas[noparse][[/noparse]conjuntoDifuso][noparse][[/noparse]coordenada]);
    ······· }

    Although double and float are reserved words, you cannot specify them
    as floating point is not natively implemented. There is a package
    Float32 in case you really need floating point math.

    regards peter
  • AjenjoAjenjo Posts: 5
    edited 2007-05-11 09:27
    And why Javelin show me the error "Unimplemented bytecode". I've find the error is in the constructor of the class "Tablas"

            // Tabla para almacenar las reglas
            private int[noparse][[/noparse]][noparse][[/noparse]] reglas;
    
            // Tabla para almacenar las coordenadas de los conjuntos difusos
            private int[noparse][[/noparse]][noparse][[/noparse]] coordenadas;
    
            public Tablas(int conjuntosDifusos, int coordenadas, int reglas) {
               (1)     this.reglas = new int[noparse][[/noparse]reglas];
               (2)     this.coordenadas = new int[noparse][[/noparse]conjuntosDifusos][noparse][[/noparse]coordenadas];
            }
    
    



    When I comment the lines (1) and (2) there're no problem, but with those 2 lines the error appears

    I only use the type int in the constructor "Tablas". Nothing of bytes.

    Thanks. Greetings.

    Post Edited (Ajenjo) : 5/11/2007 9:42:06 AM GMT
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-05-11 10:31
    You cannot define multidimensional arrays.
    You can however create something simular like this:

    private class arrY {
    · public int[noparse]/noparse Array = new int[noparse][[/noparse]256]; //y dimensions
    · public arrY() {
    · }
    }

    private arrY[noparse]/noparse myArray = new arrY[noparse][[/noparse]32]; //x dimensions

    You can then access myArray[noparse][[/noparse]x][noparse][[/noparse]y] as

    myArray[noparse][[/noparse]x].Array[noparse][[/noparse]y]

    regards peter
Sign In or Register to comment.