Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.260 and 1.262

version 1.260, 2018/09/14 02:51:39 version 1.262, 2020/12/05 05:01:18
Line 1065  sub make_numerical_bubbles { Line 1065  sub make_numerical_bubbles {
                      &Math::Random::random_uniform_integer(1,1,10);                       &Math::Random::random_uniform_integer(1,1,10);
     }      }
     for ($ind=0;$ind<$number_of_bubbles;$ind++) {      for ($ind=0;$ind<$number_of_bubbles;$ind++) {
  $bubble_values[$ind] = $answerfactor*($factor**($power-$powers[$#powers-$ind]));   my $exponent = $power-$powers[$#powers-$ind];
    $bubble_values[$ind] = $answerfactor*($factor**$exponent);
   
    # If bubble is for correct answer (i.e., exponent = 0), and value
    # of $answerfactor * factor**$exponent is an integer with more than
    # 15 digits, assign $answerfactor itself as bubble value.
    # This prevents a "use fewer digits" issue on 64bit servers
    # when correct answer is >= 1e+16, and when correct bubble is A.
   
    if ($exponent == 0) {
       if ($bubble_values[$ind] =~ /^-?(\d+)$/) {
    if (length($1) > 15) {
       $bubble_values[$ind] = $answerfactor;
    }
       }
    }
   
  $bubble_display[$ind] = &format_number($bubble_values[$ind],   $bubble_display[$ind] = &format_number($bubble_values[$ind],
        $format,$target,$safeeval);         $format,$target,$safeeval);
     }      }

Removed from v.1.260  
changed lines
  Added in v.1.262


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>