Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Firebird e Interbase (https://www.clubdelphi.com/foros/forumdisplay.php?f=19)
-   -   Arithmetic overflow (https://www.clubdelphi.com/foros/showthread.php?t=49201)

shernandez0891 16-10-2007 01:43:23

Arithmetic overflow
 
Saludos,

Cuando intento multiplicar dos variables de tipo Numeric(18,5), me marca el siguiente error, sobre todo cuando una variable se eleva, ojala y puedan ayudar, he escuchado sobre el cast pero aun no encuentro como usarlo.


Gracias.



mensaje

Unsuccessful execution caused by system error that does not precluce successful execution of subsequent statements.
Integer overflow. The result of an integer operation caused the most significant bit of the result to carry.

Arithmetic overflow or division by zero has ocurred arithmetic exception, numeric overflow, or string truncation

defcon1_es 16-10-2007 10:43:03

Cita:

Empezado por shernandez0891 (Mensaje 238739)
Unsuccessful execution caused by system error that does not precluce successful execution of subsequent statements.
Integer overflow. The result of an integer operation caused the most significant bit of the result to carry.

Arithmetic overflow or division by zero has ocurred arithmetic exception, numeric overflow, or string truncation

Pues está muy claro, el tipo de la variable donde almacenas el resultado de la multiplicación se te queda pequeño...
deberias definirlo como BIGINT o similar...

shernandez0891 16-10-2007 17:35:05

R
 
La variable donde estoy guardando la multiplicacion es del mismo tipo...


Grax

rastafarey 16-10-2007 22:13:00

Al fin paso
 
Hay un articulo que explica muy bien numeric y decimal y cual es su problema en muchos hilos he tratado de explicarles que si no saben los problemas que les puede ocasionar trbajar con este tipo de datos usen doble presicion.

La respuesta que te puede ayudar y el por uq edel error la puedes encontrar realizando una busqueda sobre este mismo foro. Que siempre aparecen con le titulo, Trabajando con decimales, problemas con decimales o algo por estilo. Si no encuentras las respuestas buscando vuelve aescribir y cuando tenga un tiempito te expkcio lo del problema.

Aunque uno pdria ser

si tiene tres variables A, B, D numeric 12, 2 y relizar uan division que te de mas de dos decimales vas a tener problemas.


La franja horaria es GMT +2. Ahora son las 21:44:58.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi