Zero divisor: /

Post Reply
FWHISHOW
Posts: 80
Joined: Thu Nov 29, 2007 2:01 pm

Zero divisor: /

Post by FWHISHOW »

Gente acontece de vez enquando este erro: Zero divisor: /

O problema é que sistema aborta sem gerar o error.log.

Alguem sabe como contornar? Pois não sei como resolver e o sistema não chega nem a gerar o error.log.

Para descobrir este erro fiz um controle de erro, assim:

bOldError := ErrorBlock( {|e| BReak(E) })
errorblock({ |oErro, a, b, c| Erro_LiberaMesa(oErro), eval(bOldError, oErro, a, b, c)})

/******************************************************************************/
function Erro_LiberaMesa(oerro)
/*
*/
local nArq,nFWarq:="Erro"+SUBSTR(TIME(),4,2)+SUBSTR(TIME(),7,2)+".txt",cstack:=""

cstack:="FIVEWIN ERROR:"+CRLF
cstack+=dtoc(date())+" "+time()+" error: "+oErro:description+": "+oErro:Operation+CRLF
cstack+=" Line: "+Str( ProcLine(), 4 )+" Arquivo: "+procfile()+ CRLF
cstack+=" Line: "+Str( ProcLine(1), 4 )+ CRLF
cstack+=" Line: "+Str( ProcLine(2), 4 )+ CRLF
cstack+=" Line: "+Str( ProcLine(3), 4 )+ CRLF
MemoWrit(Curdrive()+':\'+curdir()+'\'+nFWarq,cstack)

return(.t.)
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Post by Armando »

FWHISHOW:

Creo que el problema esta en alguna división, debes probar que el divisor no sea CERO, por ejemplo

nDivdndo := 1000.00
nDivsr := 0

nResult := nDivdndo / nDivsr // Esto te va a provocar error

Prueba así

IF nDivsr <> 0.00
nResult := nDivdndo / nDivsr
ELSE
nResult := 0.00
ENDIF

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Willi Quintana
Posts: 859
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Post by Willi Quintana »

Hola, prueba asi

nValor1 := 7
nDiviso := 0

nResult := nValor1 / IF(nDiviso =0,1, nDivisor)

....


Salu2
FWHISHOW
Posts: 80
Joined: Thu Nov 29, 2007 2:01 pm

Post by FWHISHOW »

GRACIAS A TODOS!
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Post by carlos vargas »

Code: Select all

nDivdndo := 1000.00
nDivsr     := 0

TRY
     nResult := nDivdndo / nDivsr 
CATCH oErr
     nResult := 0
     ?"Error en el calculo de la division"
END
?nResult
Salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
Post Reply