will assembly MIPS based throw exception when a 0/something instruction is executed

35 views Asked by At

I'm wondering about this question. Should I cover a possible exception or the language returns 0 in these cases?

In this snippet I'm calculating values for a matrix from a vector stored in memory. My next step is calculating the determinant. If I 'cover the exception' I'm avoiding the calculus of some matrix with 0 on its diagonal which is mathematically valid so I don't know what I should do.

I know this kind of operation is valid in so many languages but I don't know so much about this one and I don't find information at all.

I should say also this is DeLuXe Instruction Set based on MIPS if it helps.

Thanks in advance.




calculoMatriz:
         
        lf f14,cuatro  ; cuatro=4.0 para poder operar, dimension de la matriz

    lf  f6,vector+20 ; cargamos de memoria vector[6]

        sf  m,f6  ; lo almacenamos en f6

        lf  f7,vector+24 ; cargamos de memoria vector[7]

        sf  m+4,f7 ; lo almacenamos en f7

        lf  f8,vector+28 ; cargamos de memoria vector[8]


        sf  m+8,f8 ; lo almacenamos en f8


        lf  f9,vector+32 ; cargamos de memoria vector[9]

        sf  m+12,f9 ; lo almacenamos en f9

        addf f12,f6,f7   ;añadimos los dos primeros valores porque al estar vacio podemos aprovechar los operandos

        addf f12,f12,f9  ;añadimos el tercer miembro
        
        addf f12,f12,f8  ; añadimos el cuarto miembro

        divf f13,f12,f14  ; dividir por cuatro 
        
        ;beqz f12,finish ; capturar excepcion diagonal 0??;

        ;beqz f12,finish   ; capturar excepcion diagonal 0??;


        sf    mediam,f13  ; lo almacenamos en media

In my opinion I only have to avoid divisions BY zero not by zero on numerator but I'm here expecting for some information about assembler.

0

There are 0 answers