[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TRNSYS-users] Division by Zero



From experience, just put a condition on the denominator not to go to zero (even if it is never goes to zero); like when it is zero, return "1 or some convenient value"


On 24 June 2014 23:54, ITF - Adrien JEZEQUEL <a.jezequel@itf.biz> wrote:
Hi Amir

i think you divide something by an input, which is not constant, and may be null, certainly at time = 0
for example, if the output you need is the division between input_a and input_b, you may write :
output = (1-EQL(Input_b,0))*input_a/(input_b+0.001*EQL(Input_b,0))

Best regards
 
 
Logo_ITF
Adrien JEZEQUEL
Simulation Dynamique - Calculs numériques

62 rue du Bolliet
73230 SAINT-ALBAN-LEYSSE
Tél : +33(0) 479 750 029
Fax : +33(0) 479 852 122
a.jezequel@itf.biz
www.itf.biz
Feuille
Le 24/06/2014 13:38, Amir Nashed a écrit :
Hello

Does anyone know why the error of "dividing by zero" occurs?
I mean i noticed many times that i get this error although when i print out the denominator its value never reached zero.

Thank you

Amir


_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@lists.onebuilding.org
http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org


_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@lists.onebuilding.org
http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org