Skip to content

Context fraction reduce issue with the reduceConstants context flag. #1325

@drgrice1

Description

@drgrice1

With the new version of contextFraction.pl the reduce method does not seem to be correctly dealing with simplifying fractions when reduceConstants => 0 is set. The following MWE demonstrates the issue:

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'contextFraction.pl');

Context('Fraction');
Context()->flags->set(reduceConstants => 0);

$frac = Compute("-(-2) / 9")->reduce;

BEGIN_PGML
Enter [`[$frac]`]: [_]{$frac}{10}
END_PGML

ENDDOCUMENT();

The display of the fraction is a decimal in the problem, and the correct answer is not simplified at all. With the version of contextFraction.pl in PG 2.19 or before, the fraction would be displayed as simplified and not a decimal and the correct answer would be the same. Here is screen shot demonstrating what happens when you show correct answers with this problem:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions