[LON-CAPA-users] Illegal division by zero
Bob Gonzales
rgonzal at binghamton.edu
Mon Jun 1 16:33:41 EDT 2015
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
$deg2rad=0.0174532925199433
$f1=6.0221e+23
$f2=2
$mw1=296.41
$n1=0.047
$pi=3.14159265358979
$rad2deg=57.2957795130823
$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>
wrote:
> - The servers are all in the binghamton domain:
> loncapa3.chem.binghamton.edu, loncapa5,chem.binghamton.edu,
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20150601/1902e2fd/attachment.html>
More information about the LON-CAPA-users
mailing list