Hi!
This is an example entry for how I think our joined effort to complete the GPC reference could work. The section I am posting is already in existence (`abs'):
@c ----------------------------------------------------------------------------
@node abs @unnumberedsec abs @cindex abs
@unnumberedsubsec Syntax
@smallexample Function abs ( i: @var{integer type} ): @var{integer type}; @end smallexample or @smallexample Function abs ( x: @var{real type} ): @var{real type}; @end smallexample or @smallexample Function abs ( z: @var{complex type} ): @var{real type}; @end smallexample
@unnumberedsubsec Description
Returns the absolute value of the argument:
@smallexample Function abs ( x: @var{some type} ): @var{some type};
begin (* abs *) if x < 0 then abs:= -x else abs:= x; end (* abs *); @end smallexample
@unnumberedsubsec Standards
The function @samp{abs} is defined in ISO-7185 Standard Pascal; its application to complex values is defined in ISO-10206 Extended Pascal.
@unnumberedsubsec Example
@smallexample Program TestAbs;
Var i1: Complex;
begin writeln ( abs ( 42 ) ); (* 42 *); writeln ( abs ( -42 ) ); (* 42 *); writeln ( abs ( -12.1 : 0 : 1 ) ); (* 12.1 *); i1:= cmplx ( 1, 1 ); (* 1 + i *) writeln ( abs ( i1 ) : 0 : 10 ); (* yields 1.4142135624, i.e. sqrt ( 2 ) *) end. @end smallexample
@unnumberedsubsec See also
@ref{sqr}.
@c ----------------------------------------------------------------------------
If you follow-up to this mail and modify the section, please include a complete copy without leading "> " or such in order to make it easier for me to integrate the modified copy into `reference.texi'.
Peter
PS: I just was pointed to some errors in the above, so you can expect my own follow-up to this in a few minutes. :-)