📄 interval.html
字号:
<HTML><!-- -- Copyright (c) 1998,1999 -- University of Notre Dame -- -- Permission to use, copy, modify, distribute and sell this software -- and its documentation for any purpose is hereby granted without fee, -- provided that the above copyright notice appears in all copies and -- that both that copyright notice and this permission notice appear -- in supporting documentation. The University of Notre Dame makes no -- representations about the suitability of this software for any -- purpose. It is provided "as is" without express or implied warranty. -- --><HEAD><TITLE>Description of interval</TITLE></HEAD><BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" ALINK="#ff0000"> <FONT FACE=Helvetica><!--end header--><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=100%><TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><TR><TD Align=left valign=middle width=440 rowspan=2><FONT FACE=verdana,arial,helvetica SIZE=+3 COLOR=#110088><B>interval<Tnum></B></FONT></TD><TD valign=middle Align=right width=128 rowspan=2><A HREF="http://lsc.nd.edu/research/mtl"><IMG BORDER=0 SRC="./glossy-mtl-logo.jpg" height=48 ALT="[MTL Home]"></A></TD><TD Align=center width=280 nowrap><Font face=verdana,arial,helvetica size=+3><b>Programmers Guide</b></font></TD></TR><TR BGCOLOR='#2020b0'><TD HEIGHT=20 VALIGN='MIDDLE' NOWRAP align=center STYLE="font-family:verdana,arial,helvetica;font-weight:bold;"> <A STYLE="text-decoration:none;color:white;font-family:verdana,arial,helvetica;font-weight:bold;" HREF="./table_of_contents.html">Contents</A> | <A STYLE="text-decoration:none;color:white;font-family:verdana,arial,helvetica;font-weight:bold;" HREF="./mtl_index.html">Index</A> | <A STYLE="text-decoration:none;color:white;font-family:verdana,arial,helvetica;font-weight:bold;" HREF="http://lsc.nd.edu/research/mtl/search.html">Search</A> </TD></TR></TABLE></TD></TR><TR><TD><Table Border=0 CellPadding=0 CellSpacing=0 width=100% cols=2><TR><TD Align=left><BR><TABLE BORDER=0 CellSpacing=0 CellPadding=0><TR><TD><Img src = "intervals.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR><TR><TD><Img src = "containers.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR></TABLE></TD><TD Align=right><BR><TABLE BORDER=0 CellSpacing=0 CellPadding=0><TR><TD><Img src = "type.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR></TABLE></TD></TR><TR><TD Align=left VAlign=top><b>Category</b>:intervals,containers</TD><TD Align=right VAlign=top><b>Component type</b>:type</TD></TR></Table></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="10" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Description</B></FONT></TD></TR><TR><TD>A number type which implements <A HREF="interval.html" >interval</A> arithmetic. Evaluation of an operation performed on an <A HREF="interval.html" >interval</A> will calculate the upperand lower bounds of a <A HREF="set.html" >set</A> of numbers. Within this <A HREF="set.html" >set</A> one can be certain that the answer lies. Interval operations round an <A HREF="interval.html" >interval</A> "outward" (rounding the lower bound down and the upper bound up) to ensure that the exact answer will be within the <A HREF="interval.html" >interval</A> returned.<P>For example:<Br> On a machine with very limited precision, If an <A HREF="interval.html" >interval</A> A bounded by 2.0 and 3.0 were added to an <A HREF="interval.html" >interval</A> B bounded by 1.0 and 2.0, the sum (after outward rounding) may be an <A HREF="interval.html" >interval</A> bounded by 3.01 and 5.01.<BR>Or, in code:<P><CODE><A HREF="interval.html" >interval</A><double> A(2.0,3.0), B(1.0,2.0);<BR><BR>cout << A+B;<P></CODE>may return <code>[3.01,5.01]</code>.<Br>When output to a character stream, intervals are expressed in the form <code>[x,y]</code> where <code>x</code> is the lower (or left) bound and <code>y</code> is the upper (right) bound.</TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Example</B></FONT></TD></TR><TR><TD>In <A HREF=file:/afs/nd.edu/user1/lsc/Students/arodrig6/MTL-learn/mtl2/mtl/contrib/interval/doc/expamples/construct.cc>construct.cc</A>:<PRE> interval<double> normal(1,2); interval<double> single(1); interval<double> exact(1,2,true); interval<double> copy_interval(normal);</PRE></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Definition</B></FONT></TD></TR><TR><TD><A HREF="interval.h">interval.h</A></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Template Parameters</B></FONT></TD></TR><TR><TD></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Model of</B></FONT></TD></TR><TR><TD></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Members</B></FONT></TD></TR><TR><TD><TABLE BORDER><TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR> <TR><TD VALIGN="TOP"><TT> <TT>value_type </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> <TT>interval (const Tnum& le, const Tnum& ri,bool exact) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Exact constructor (no outward rounding) </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> <TT>interval (const Tnum& le, const Tnum& ri) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Normal constructur </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> <TT>interval (const Tnum& x = Tnum()) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Default constructor/ Single Tnum constructor </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> <TT>interval (const self&) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> template <class X><br> <TT>interval (const <A HREF="interval.html" >interval</A><X>&) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> const Tnum& <TT>left () const</TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Constant accessor for the lower bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> const Tnum& <TT>right () const</TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Constant accessor for the upper bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> Tnum& <TT>left (void) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Accessor for the lower bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> Tnum& <TT>right (void) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Accessor for the upper bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> const Tnum& <TT>inf () const</TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Alternate constant accessor for the lower bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> const Tnum& <TT>sup () const</TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Alternate constant accessor for the upper bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> Tnum& <TT>inf (void) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Alternate accessor for the lower bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> Tnum& <TT>sup (void) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> Alternate accessor for the upper bound of an <A HREF="interval.html" >interval</A> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> self& <TT>operator= (const Tnum&) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> self& <TT>operator+= (const Tnum&) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> self& <TT>operator-= (const Tnum&) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> self& <TT>operator*= (const Tnum&) </TT> </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -