Files
mercury/extras/complex_numbers/imag_float.m
Fergus Henderson d23f11ac33 Use sub-modules to package up the modules in extras/complex_numbers
Estimated hours taken: 0.75

Use sub-modules to package up the modules in extras/complex_numbers
into a single module.

extras/complex_numbers/complex_lib.m:
extras/complex_numbers/complex_numbers.m:
	Rename complex_lib.m as complex_numbers.m,
	and modify it to use sub-modules.

extras/complex_numbers/*.m:
extras/complex_numbers/tests/complex_test.m:
extras/complex_numbers/samples/fft.m:
	Add `complex_numbers:' to all of the `:- module'
	and `:- import_module' declarations.

extras/complex_numbers/Mmakefile:
extras/complex_numbers/tests/Mmakefile:
extras/complex_numbers/samples/Mmakefile:
	Modify to reflect the renaming from `complex_lib' to
	`complex_numbers'.
1998-05-29 09:08:43 +00:00

55 lines
1.6 KiB
Mathematica

%---------------------------------------------------------------------------%
% Copyright (C) 1997-1998 The University of Melbourne.
% This file may only be copied under the terms of the GNU Library General
% Public License - see the file COPYING.LIB in the Mercury distribution.
%---------------------------------------------------------------------------%
%
% File: imag_float.m.
% Main author: fjh.
% Stability: medium.
%
% This module provides binary operators on (imag, float).
%
% See also:
% complex.m, imag.m, float_imag.m.
%
%---------------------------------------------------------------------------%
:- module complex_numbers:imag_float.
:- interface.
:- import_module complex_numbers:imag, float, complex_numbers:complex.
% addition
:- func imag + float = complex.
:- mode in + in = uo is det.
:- mode uo + uo = in is det.
% subtraction
:- func imag - float = complex.
:- mode in - in = uo is det.
:- mode uo - uo = in is det.
% multiplication
:- func imag * float = imag.
:- mode in * in = uo is det.
:- mode in * uo = in is det.
:- mode uo * in = in is det.
% division
:- func imag / float = imag.
:- mode in / in = uo is det.
:- mode in / uo = in is det.
:- mode uo / in = in is det.
%---------------------------------------------------------------------------%
:- implementation.
im(XI) + YR = cmplx(0.0 + YR, 0.0 + XI).
im(XI) - YR = cmplx(0.0 - YR, 0.0 + XI).
im(XI) * YR = im(XI * YR).
im(XI) / YR = im(XI / YR).
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%