I have an exercise where a quadratic function is plotted. The code for the problem identifies where the vertex and y-intercept will be, and uses these locations to help set the viewing window. In one random version of this problem, something is going very wrong. I whittled down the code to the MWE pasted below.

There is an array, @y. It contains two Real Math Objects, with one clearly smaller than the other. But min(@y) is returning the larger number. I guess that the min function is using a comparison operator for MathObject Reals, and my values are so close together, that they are equal by the fuzzy comparisons used by Math Objects.

So I can't trust min() and max() to work on Math Objects if the entries of the array are close. My question is, do we accept this? Or do we replace min() and max() so that when a Math Object number is an input, it automatically uses the ->value method to get a perl real?

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

);

@y = (

Real(2001),

Real(2000)

);

TEXT('The array @y is:',$BR,join($BR,@y),$PAR);

TEXT('But its min is:',$BR,min(@y));

ENDDOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

);

@y = (

Real(2001),

Real(2000)

);

TEXT('The array @y is:',$BR,join($BR,@y),$PAR);

TEXT('But its min is:',$BR,min(@y));

ENDDOCUMENT();