Forum archive 2000-2006

Arnold K. Pizer - Buggy log( ) function

Arnold K. Pizer - Buggy log( ) function

by Arnold Pizer -
Number of replies: 0
inactiveTopicBuggy log( ) function topic started 9/14/2004; 6:42:59 PM
last post 9/14/2004; 6:42:59 PM
userArnold K. Pizer - Buggy log( ) function  blueArrow
9/14/2004; 6:42:59 PM (reads: 793, responses: 0)
There is a bug with the log function in both WeBWork 2 and WeBWork 1.9.05. By default the log function is supposed to give the natural log but it can be set to give log to the base ten. Note that ln is always the natural log and logten is always log to the base ten.

If useBaseTenLog is set to 0 in global.conf or course.conf for WeBWork 2 or in Global.pm or webworkCourse.ph for WeBWork 1.9.05, then log is supposed to give the natural log. Setting useBaseTenLog to 1 makes log the log to the base ten. The bug is that no matter how this is set, log gives the log to the base ten. The fix is easy.

You have to edit (or download from the CVS) the file PGanswermacros.pl. For WeBWork 2 it is located in .../webwork/pg/macros/ and for WeBWork 1.9.05 it is located in .../webwork/system/courseScripts/

Around lines 164-6 change

$useBaseTenLog = main::PG_restricted_eval(q!\%main::useBaseTenLog!);
to
$useBaseTenLog = main::PG_restricted_eval(q!$main::useBaseTenLog!);

i.e. change \% to $

A few problems in the library use the log function in their correct answers when they should really use ln. These problems will be wrong whenever useBaseTenLog is set to 1. We will correct these problems in the CVS when we come upon them.

Arnie

<| Post or View Comments |>