cpxd.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
---------------------------> Sather 1.1 source file <--------------------------
-- cpxd.sa: Other complex numbers
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: cpxd.sa,v 1.7 1996/07/25 19:17:55 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.
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