Changeset bc82d6 in git for factory/ftest


Ignore:
Timestamp:
Mar 31, 1998, 12:23:59 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', '6e5adcba05493683b94648c659a729c189812c77')
Children:
847ebddd2a19445d1f5f58aa9aae2175e2ba965c
Parents:
cc94b0aa665105d616f94ce4f3c3cd02b336adca
Message:
***** merge from branch `factory-gcd' to main trunk


git-svn-id: file:///usr/local/Singular/svn/trunk@1292 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/ftest/fbinops.m4

    rcc94b0a rbc82d6  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: fbinops.m4,v 1.3 1997-12-17 12:16:40 schmidt Exp $ */
     2/* $Id: fbinops.m4,v 1.4 1998-03-31 10:23:59 schmidt Exp $ */
    33
    44ftestSetNameOfGame( fbinops, `"
     
    77
    88  The following operators (with aliases) are recognized:
    9   `+', `-', `*' (= `mul'), `/', `%': return a canonicalform;
     9  `+', `-', `*' (= `mul'), `/', `div', `%', `mod': return a canonicalform;
    1010  `==', `!=', `<' (= `lt'), `>' (= `gt'): return an integer (i.e. boolean)
    1111"'`' )
     
    157157    return UndefinedResult;
    158158}
     159
     160static ftestStatusT
     161ftestDivideTest( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm & quot )
     162{
     163    if ( ! ((quot*g)+(f%g)-f).isZero() ) {
     164        ftestError( CheckError, "f != (f/g)*g+(f%%g)\n" );
     165        return Failed;
     166    } else
     167        return Passed;
     168}
     169
     170static ftestStatusT
     171ftestDivTest( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm & quot )
     172{
     173    if ( ! (f%g).isZero() ) {
     174        ftestError( CheckError, "g does not divide f\n" );
     175        return Failed;
     176    } else if ( f != (quot*g) ) {
     177        ftestError( CheckError, "f != (div(f, g)*g)\n" );
     178        return Failed;
     179    } else
     180        return Passed;
     181}
     182
     183static ftestStatusT
     184ftestModuloTest( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm & rem )
     185{
     186    if ( ! (((f/g)*g)+(rem)-f).isZero() ) {
     187        ftestError( CheckError, "f != (f/g)*g+(f%%g)\n" );
     188        return Failed;
     189    } else
     190        return Passed;
     191}
    159192//}}}
    160193
     
    171204    { &operator*, ftestArithTest, "*", "f*g" },
    172205    { &operator*, ftestArithTest, "mul", "f*g" },
    173     { &operator/, ftestArithTest, "/", "f/g" },
    174     { &operator%, ftestArithTest, "%", "f%g" },
     206    { &operator/, ftestDivideTest, "/", "f/g" },
     207    { &div, ftestDivTest, "div", "div(f,g)" },
     208    { &operator%, ftestModuloTest, "%", "f%g" },
     209    { &mod, ftestModuloTest, "mod", "mod(f,g)" },
    175210    { 0, 0, 0, 0 }
    176211};
Note: See TracChangeset for help on using the changeset viewer.