comparing Formulas in Fraction context

Abierto
#1,563 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
perl
Área
backend

Línea de trabajo

Start by reading the Fraction context and formula comparison code; the issue names contextFraction.pl and PGstandard.pl, but gives no source file or test for the comparison behavior. Reproduce the example in a PG problem and trace how test points and formula outputs are compared. Done means deciding and implementing the expected comparison semantics for formulas in Fraction context, with tests covering the example.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Consider the problem:

DOCUMENT();

loadMacros(qw(PGstandard.pl PGML.pl contextFraction.pl));

Context("Fraction");
$Ap = Formula("270 + 7/80 x");

BEGIN_PGML
[_]{$Ap}

The answer is supposed to be [`[$Ap]`].

But something like [|270 + 0.1 x|]* is accepted.
END_PGML

ENDDOCUMENT();

The issue is described in the text of the problem. I am guessing that relative error tolerance is in effect, and for test points, 270+0.1x and 270+7/80x are equivalent. So maybe I should adjust the tolerance settings on the exercise that gave rise to this concern.

However, I thought it reasonable that in Fraction context, that we could do like:

  • the test points are random fractions, not random floating points.
  • the output from each formula is cast as a fraction (in the same way that 3.14159265359 becomes 245850922/78256779)
  • comparison is done as with non-formula Fraction objects; either they are equal as fractions, or not.

Would that be reasonable?

Lenguaje dominante
Perl
Estrellas
48
Forks
78
Merge medio
5 d 13 h
PR fusionados (30 d)
9

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de openwebwork/pg

Todos los issues de openwebwork/pg

Issues similares

Más issues de Perl

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.