cpxd.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 1995 by International Computer Science Institute            --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------

-- cpxd.sa: Other complex numbers
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>


immutable class CPXD < $CPX_NUMBER{FLTD,CPXD},$FMT

immutable class CPXD < $CPX_NUMBER{FLTD,CPXD},$FMT is include CPX{FLTD}; fmt( fmt: STR ): STR is comma: INT; fmt1: STR; comma := fmt.search(';'); if comma >= 0 then fmt1 := fmt.head(comma); fmt := fmt.substring(comma+1) else fmt1 := fmt end; if ~fmt1.is_prefix("polar") then return re.fmt(fmt1) + '+' + im.fmt(fmt) + 'i' else fmt1 := fmt1.substring(5); return absolute.fmt(fmt1) + "*e^" + phase.fmt(fmt) + 'i' end; end; end; -- class CPXD