1/* 2 * test3100 - 3100 series of the regress.cal test suite 3 * 4 * Copyright (C) 1999 Ernest Bowen and Landon Curt Noll 5 * 6 * Primary author: Ernest Bowen 7 * 8 * Calc is open software; you can redistribute it and/or modify it under 9 * the terms of the version 2.1 of the GNU Lesser General Public License 10 * as published by the Free Software Foundation. 11 * 12 * Calc is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 * Public License for more details. 16 * 17 * A copy of version 2.1 of the GNU Lesser General Public License is 18 * distributed with calc under the filename COPYING-LGPL. You should have 19 * received a copy with calc; if not, write to Free Software Foundation, Inc. 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Under source code control: 1995/11/28 11:56:57 23 * File existed as early as: 1995 24 * 25 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 */ 27 28 29obj res {r}; 30global md; 31define res_test(a) = !ismult(a.r, md); 32define res_sub(a,b) {local obj res v = {(a.r - b.r) % md}; return v;}; 33define res_mul(a,b) {local obj res v = {(a.r * b.r) % md}; return v;}; 34define res_neg(a) {local obj res v = {(-a.r) % md}; return v;}; 35define res_inv(a) {local obj res v = {minv(a.r, md)}; return v;}; 36define res(x) {local obj res v = {x % md}; return v;}; 37