You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
4.7 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for GNU MPC, a library for multiple precision complex arithmetic,
version 1.0.3 of February 2015.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 INRIA
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections. A copy of the license is included in the section
entitled "GNU Free Documentation License." -->
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Complex Comparison (GNU MPC 1.0.3)</title>
<meta name="description" content="Complex Comparison (GNU MPC 1.0.3)">
<meta name="keywords" content="Complex Comparison (GNU MPC 1.0.3)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="Complex-Functions.html#Complex-Functions" rel="up" title="Complex Functions">
<link href="Projection-_0026-Decomposing.html#Projection-_0026-Decomposing" rel="next" title="Projection &amp; Decomposing">
<link href="String-and-Stream-Input-and-Output.html#String-and-Stream-Input-and-Output" rel="prev" title="String and Stream Input and Output">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Complex-Comparison"></a>
<div class="header">
<p>
Next: <a href="Projection-_0026-Decomposing.html#Projection-_0026-Decomposing" accesskey="n" rel="next">Projection &amp; Decomposing</a>, Previous: <a href="String-and-Stream-Input-and-Output.html#String-and-Stream-Input-and-Output" accesskey="p" rel="prev">String and Stream Input and Output</a>, Up: <a href="Complex-Functions.html#Complex-Functions" accesskey="u" rel="up">Complex Functions</a> &nbsp; [<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Comparison-Functions"></a>
<h3 class="section">5.5 Comparison Functions</h3>
<a name="index-Complex-comparisons-functions"></a>
<a name="index-Comparison-functions"></a>
<dl>
<dt><a name="index-mpc_005fcmp"></a>Function: <em>int</em> <strong>mpc_cmp</strong> <em>(mpc_t <var>op1</var>, mpc_t <var>op2</var>)</em></dt>
<dt><a name="index-mpc_005fcmp_005fsi_005fsi"></a>Function: <em>int</em> <strong>mpc_cmp_si_si</strong> <em>(mpc_t <var>op1</var>, long int <var>op2r</var>, long int <var>op2i</var>)</em></dt>
<dt><a name="index-mpc_005fcmp_005fsi"></a>Macro: <em>int</em> <strong>mpc_cmp_si</strong> <em>(mpc_t <var>op1</var>, long int <var>op2</var>)</em></dt>
<dd>
<p>Compare <var>op1</var> and <var>op2</var>, where in the case of <code>mpc_cmp_si_si</code>,
<var>op2</var> is taken to be <var>op2r</var> + i <var>op2i</var>.
The return value <var>c</var> can be decomposed into <code>x = MPC_INEX_RE(c)</code>
and <code>y = MPC_INEX_IM(c)</code>, such that <var>x</var> is
positive if the real part of <var>op1</var> is greater than that of <var>op2</var>,
zero if both real parts are equal, and negative if the real part of <var>op1</var>
is less than that of <var>op2</var>, and likewise for <var>y</var>.
Both <var>op1</var> and <var>op2</var> are considered to their full own precision,
which may differ.
It is not allowed that one of the operands has a NaN (Not-a-Number) part.
</p>
<p>The storage of the return value is such that equality can be simply checked
with <code>mpc_cmp (op1, op2) == 0</code>.
</p></dd></dl>
</body>
</html>