number.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
---------------------------> Sather 1.1 source file <--------------------------
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: number.sa,v 1.4 1996/06/01 21:34:13 gomes Exp $
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
abstract class $NUMBER{NTP} < $IS_LT{NTP},$NIL,$STR
abstract class $NUMBER{NTP} < $IS_LT{NTP},$NIL,$STR is
-- Abstract class defined over all numbers
-- Due to contravariance, we need to parametrize over NTP which is the
-- type of the argument to many of the defined routines.
zero: NTP;
-- Return the zero value
maxval: NTP;
-- Return the maximal allowed value
-- minval: SAME;
-- Return the minimal allowed value (not yet defined for FLT)
times(n: NTP): SAME;
-- Return self * n
plus(n: NTP): SAME;
-- Return self+n
minus(n: NTP): SAME;
-- Return self - n
div(n: NTP): SAME;
-- Return the quotient of self and "n"
end; -- class $NUMBER