Zero divisor: /

Zero divisor: /

Postby FWHISHOW » Fri Jan 18, 2008 6:15 pm

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.)
FWHISHOW
 
Posts: 80
Joined: Thu Nov 29, 2007 2:01 pm

Postby Armando » Sat Jan 19, 2008 3:02 am

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
Armando
 
Posts: 3235
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby Willi Quintana » Sat Jan 19, 2008 3:43 am

Hola, prueba asi

nValor1 := 7
nDiviso := 0

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

....


Salu2
User avatar
Willi Quintana
 
Posts: 1022
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Postby FWHISHOW » Sat Jan 19, 2008 10:20 am

GRACIAS A TODOS!
FWHISHOW
 
Posts: 80
Joined: Thu Nov 29, 2007 2:01 pm

Postby carlos vargas » Tue Jan 22, 2008 10:32 pm

Code: Select all  Expand view  RUN
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)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 25 guests