Problem Seed: 1133
With this seed the @d array is all zeros, which means that $s is 0, so the calculation of $t leads to a division by zero error.
I see two ways to fix this:
- If you want to allow a data set where the left and right are always identical, then add a conditional that sets
$t=0 if $s==0, skipping the more general calculation of $t.
- Beef up the
do... until loop to skip cases where $s==0, which would mean a student would never get a case when the standard deviation is 0.
Tagging @d-torrance since this is a Piedmont Contrib problem.