Skip to content

Commit

Permalink
report error when Gcd() is called with floating point argument
Browse files Browse the repository at this point in the history
Task #107 - GCD: wrong answer with float
  • Loading branch information
grzegorzmazur committed Aug 21, 2015
1 parent 90f613b commit 0a1938c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/multivar.rep/code.ys
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ MultiContentTerm(multi_IsMulti)
MultiContentScan(_coefs,_fact) <--
[
Set(least,Min({least,coefs}));
Set(gcd,Gcd(gcd,fact));
Set(gcd,If(IsRational(gcd) And IsRational(fact), Gcd(gcd,fact), 1));
];
UnFence("MultiContentScan",2);

Expand Down
3 changes: 3 additions & 0 deletions scripts/stubs.rep/code.ys
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ Sqrt(xlist_IsList) <-- MapSingle("Sqrt",xlist);
NormalForm(Gcd(MakeUni(n,vars),MakeUni(m,vars)));
];

90 # Gcd(x_IsNumber, _y) <-- Check(False, "Gcd: argument is not an exact number");
90 # Gcd(_x, y_IsNumber) <-- Check(False, "Gcd: argument is not an exact number");

100 # Gcd(n_IsConstant,m_IsConstant) <-- 1;

30 # PolynomialGcd(n_CanBeUni, m_CanBeUni)_(Length(VarList(n*m))=1) <--
Expand Down
3 changes: 0 additions & 3 deletions tests/regress.yts
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,6 @@ Verify((Limit(x,0) (x+1)^(Ln(a)/x)), a);
otherwise it's parsed as Limit (... = ...) */

/* Bug #3 */
KnownFailure(Gcd(10,3.3) != 3.3 And Gcd(10,3.3) != 1);
/* I don't know what the answer should be, but buth 1 and 3.3 seem */
/* certainly wrong. */
Verify(Gcd(-10, 0), 10);
Verify(Gcd(0, -10), 10);

Expand Down

0 comments on commit 0a1938c

Please sign in to comment.