# [LON-CAPA-users] Illegal division by zero

Herrick, Robert J rherrick at purdue.edu
Mon Jun 1 16:45:55 EDT 2015

```Hi
Sure.

Sent from my iPhone

On Jun 1, 2015, at 4:37 PM, Bob Gonzales <rgonzal at binghamton.edu<mailto:rgonzal at binghamton.edu>> wrote:

So, I got another one today.  If you look at 'Script Vars' for partB, an answer was actually calculated for the part.  Here's a cut and paste from the 'Script Vars' windows while viewing the message:

\$ansa=9.54889173779562e+16
\$ansb=1.90977834755912e+17
\$f1=6.0221e+23
\$f2=2
\$mw1=296.41
\$n1=0.047
\$pi=3.14159265358979
\$sub2=oxygen
\$t1=2
\$t2=3
\$unit1=molecules
\$uselessVariable=partB

\$ansb is the answer for this part, \$f1 is the variable in the denominator that lon-capa is referring to in the message:

Illegal division by zero at (eval 88895) line 6.

occurred while running

\$t2=&random(1,3);
\$sub2=&choose(\$t2,"carbon","hydrogen","oxygen");
\$f2=&choose(\$t2,20.0,24.0,2.0);
\$uselessVariable="partB";
\$ansb=(\$ansa/\$f1)* \$f2 * 6.0221e23;

This error occurred while processing part t06p12b
The error occurred on host binghamtona7

So, I don't know how lon-capa calculated the answer and then complained about an illegal divide by zero.

Any thoughts?

Bob Gonzales

On Fri, May 29, 2015 at 4:37 PM, Bob Gonzales <rgonzal at binghamton.edu<mailto:rgonzal at binghamton.edu>> wrote:
- The servers are all in the binghamton domain:  loncapa3.chem.binghamton.edu<http://loncapa3.chem.binghamton.edu>, loncapa5,chem.binghamton.edu<http://chem.binghamton.edu>, loncapa7.chem.binghamton.edu<http://loncapa7.chem.binghamton.edu>.  The machines are not identical machines.  I believe they are 7, 5, 2 years old respectively.  They all have 8 GB or better of memory.  They are all Xenons with multiple cores.  They are all running Centos 5.11 and Loncapa  2.10.1.

- This is occurred for 3 students, 2 other students have gotten it correct.  Many others haven't tried it yet.

- We've used this problem before and haven't gotten bombs before.  But, of course, there have been many Centos updates applied since we used it last summer.

- Setting all the variables in partA would take care of it but I've always done it this way to cut down on the scrolling up and down when creating/editing problems.

- Clicking 'Script Vars' while viewing the message does show the variable with a value.

- I set a useless variable in the first part and changed it's value in the second part per Damien's suggestion,  we will see what happens.

Thanks for all the feedback.  I will keep you posted.

Bob

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org<mailto:LON-CAPA-users at mail.lon-capa.org>
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20150601/73de013a/attachment.html>
```