OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [math-library-compatibility-modes.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Math library compatibility modes</TITLE
>Math library compatibility modes</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="eCos Reference Manual"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
HREF="ecos-ref.html"><LINK
REL="UP"
REL="UP"
TITLE="C and math library overview"
TITLE="C and math library overview"
HREF="c-and-math-library-overview.html"><LINK
HREF="c-and-math-library-overview.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="C and math library overview"
TITLE="C and math library overview"
HREF="c-and-math-library-overview.html"><LINK
HREF="c-and-math-library-overview.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="Some implementation details"
TITLE="Some implementation details"
HREF="libc-implementation-details.html"></HEAD
HREF="libc-implementation-details.html"></HEAD
><BODY
><BODY
CLASS="SECT1"
CLASS="SECT1"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>eCos Reference Manual</TH
>eCos Reference Manual</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="c-and-math-library-overview.html"
HREF="c-and-math-library-overview.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
>Chapter 13. C and math library overview</TD
>Chapter 13. C and math library overview</TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="libc-implementation-details.html"
HREF="libc-implementation-details.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><DIV
><DIV
CLASS="SECT1"
CLASS="SECT1"
><H1
><H1
CLASS="SECT1"
CLASS="SECT1"
><A
><A
NAME="MATH-LIBRARY-COMPATIBILITY-MODES">Math library compatibility modes</H1
NAME="MATH-LIBRARY-COMPATIBILITY-MODES">Math library compatibility modes</H1
><P
><P
>This math library is capable of being operated in several
>This math library is capable of being operated in several
different compatibility modes. These options deal solely with how
different compatibility modes. These options deal solely with how
errors are handled. </P
errors are handled. </P
><P
><P
>There are 4 compatibility modes: ANSI/POSIX 1003.1;
>There are 4 compatibility modes: ANSI/POSIX 1003.1;
IEEE-754; X/Open Portability Guide issue 3 (XPG3); and
IEEE-754; X/Open Portability Guide issue 3 (XPG3); and
System V Interface Definition Edition 3. </P
System V Interface Definition Edition 3. </P
><P
><P
>In IEEE mode, the <TT
>In IEEE mode, the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
> function
> function
(see below) is never called, no warning messages are printed on
(see below) is never called, no warning messages are printed on
the stderr output stream, and errno is never set. </P
the stderr output stream, and errno is never set. </P
><P
><P
>In ANSI/POSIX mode, errno is set correctly,
>In ANSI/POSIX mode, errno is set correctly,
but <TT
but <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
> is never called and no warning messages
> is never called and no warning messages
are printed on the stderr output stream. </P
are printed on the stderr output stream. </P
><P
><P
>In X/Open mode, errno is set correctly,
>In X/Open mode, errno is set correctly,
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
> is called, but no warning messages are printed
> is called, but no warning messages are printed
on the stderr output stream. </P
on the stderr output stream. </P
><P
><P
>In SVID mode, functions which overflow return
>In SVID mode, functions which overflow return
a value HUGE (defined in <TT
a value HUGE (defined in <TT
CLASS="FILENAME"
CLASS="FILENAME"
>math.h</TT
>math.h</TT
>), which is the maximum
>), which is the maximum
single precision floating point value (as opposed to
single precision floating point value (as opposed to
HUGE_VAL which is meant to stand for infinity). errno is
HUGE_VAL which is meant to stand for infinity). errno is
set correctly and <TT
set correctly and <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
> is called. If
> is called. If
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
> returns 0, warning messages are printed on
> returns 0, warning messages are printed on
the stderr output stream for some errors. </P
the stderr output stream for some errors. </P
><P
><P
>The mode can be compiled-in as IEEE-only, or any one of the
>The mode can be compiled-in as IEEE-only, or any one of the
above methods settable at run-time. </P
above methods settable at run-time. </P
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>This math library assumes that the hardware (or software floating
>This math library assumes that the hardware (or software floating
point emulation) supports IEEE-754 style arithmetic, 32-bit 2's
point emulation) supports IEEE-754 style arithmetic, 32-bit 2's
complement integer arithmetic, doubles are in 64-bit IEEE-754 format.</P
complement integer arithmetic, doubles are in 64-bit IEEE-754 format.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="AEN10153">matherr()</H2
NAME="AEN10153">matherr()</H2
><P
><P
>As mentioned above, in X/Open or SVID modes, the user
>As mentioned above, in X/Open or SVID modes, the user
            can supply a function <TT
            can supply a function <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
> of
> of
            the form:</P
            the form:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>int <TT
>int <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr</TT
>matherr</TT
>( struct exception *e )</PRE
>( struct exception *e )</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>where struct exception is defined as:</P
>where struct exception is defined as:</P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="PROGRAMLISTING"
CLASS="PROGRAMLISTING"
>struct exception {
>struct exception {
 int type;
 int type;
 char *name;
 char *name;
 double arg1, arg2, retval;
 double arg1, arg2, retval;
}; </PRE
}; </PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
>type is the exception type and is one of:</P
>type is the exception type and is one of:</P
><P
><P
></P
></P
><DIV
><DIV
CLASS="VARIABLELIST"
CLASS="VARIABLELIST"
><DL
><DL
><DT
><DT
>DOMAIN</DT
>DOMAIN</DT
><DD
><DD
><P
><P
>argument domain exception</P
>argument domain exception</P
></DD
></DD
><DT
><DT
>SING</DT
>SING</DT
><DD
><DD
><P
><P
>argument singularity</P
>argument singularity</P
></DD
></DD
><DT
><DT
>OVERFLOW</DT
>OVERFLOW</DT
><DD
><DD
><P
><P
>overflow range exception</P
>overflow range exception</P
></DD
></DD
><DT
><DT
>UNDERFLOW</DT
>UNDERFLOW</DT
><DD
><DD
><P
><P
>underflow range exception</P
>underflow range exception</P
></DD
></DD
><DT
><DT
>TLOSS</DT
>TLOSS</DT
><DD
><DD
><P
><P
>total loss of significance</P
>total loss of significance</P
></DD
></DD
><DT
><DT
>PLOSS</DT
>PLOSS</DT
><DD
><DD
><P
><P
>partial loss of significance</P
>partial loss of significance</P
></DD
></DD
></DL
></DL
></DIV
></DIV
><P
><P
><TT
><TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>name</I
>name</I
></TT
></TT
> is a string containing the name of the
> is a string containing the name of the
function</P
function</P
><P
><P
><TT
><TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>arg1</I
>arg1</I
></TT
></TT
> and <TT
> and <TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>arg2</I
>arg2</I
></TT
></TT
> are the
> are the
arguments passed to the function</P
arguments passed to the function</P
><P
><P
><TT
><TT
CLASS="PARAMETER"
CLASS="PARAMETER"
><I
><I
>retval</I
>retval</I
></TT
></TT
> is the default value that will be returned
> is the default value that will be returned
by the function, and can be changed by <TT
by the function, and can be changed by <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
></P
></P
><DIV
><DIV
CLASS="NOTE"
CLASS="NOTE"
><BLOCKQUOTE
><BLOCKQUOTE
CLASS="NOTE"
CLASS="NOTE"
><P
><P
><B
><B
>Note: </B
>Note: </B
>matherr must have &#8220;C&#8221; linkage, not &#8220;C&#0043;&#0043;&#8221; linkage.</P
>matherr must have &#8220;C&#8221; linkage, not &#8220;C&#0043;&#0043;&#8221; linkage.</P
></BLOCKQUOTE
></BLOCKQUOTE
></DIV
></DIV
><P
><P
>If matherr returns zero, or the user doesn't supply
>If matherr returns zero, or the user doesn't supply
their own matherr, then the following <SPAN
their own matherr, then the following <SPAN
CLASS="emphasis"
CLASS="emphasis"
><I
><I
CLASS="EMPHASIS"
CLASS="EMPHASIS"
>usually</I
>usually</I
></SPAN
></SPAN
> happens
> happens
in SVID mode:</P
in SVID mode:</P
><DIV
><DIV
CLASS="TABLE"
CLASS="TABLE"
><A
><A
NAME="AEN10199"><P
NAME="AEN10199"><P
><B
><B
>Table 13-1. Behavior of math exception handling</B
>Table 13-1. Behavior of math exception handling</B
></P
></P
><TABLE
><TABLE
BORDER="1"
BORDER="1"
CLASS="CALSTABLE"
CLASS="CALSTABLE"
><THEAD
><THEAD
><TR
><TR
><TH
><TH
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Type</TH
>Type</TH
><TH
><TH
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>Behavior</TH
>Behavior</TH
></TR
></TR
></THEAD
></THEAD
><TBODY
><TBODY
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>DOMAIN</TD
>DOMAIN</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>0.0 returned,
>0.0 returned,
errno=EDOM, and a message printed on stderr</TD
errno=EDOM, and a message printed on stderr</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>SING</TD
>SING</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>HUGE of appropriate
>HUGE of appropriate
sign is returned, errno=EDOM, and a message is printed
sign is returned, errno=EDOM, and a message is printed
on stderr</TD
on stderr</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>OVERFLOW</TD
>OVERFLOW</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>HUGE of
>HUGE of
appropriate sign is returned, and errno=ERANGE</TD
appropriate sign is returned, and errno=ERANGE</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>UNDERFLOW</TD
>UNDERFLOW</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>0.0 is
>0.0 is
returned and errno=ERANGE</TD
returned and errno=ERANGE</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>TLOSS</TD
>TLOSS</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>0.0 is returned,
>0.0 is returned,
errno=ERANGE, and a message is printed on stderr</TD
errno=ERANGE, and a message is printed on stderr</TD
></TR
></TR
><TR
><TR
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>PLOSS</TD
>PLOSS</TD
><TD
><TD
ALIGN="LEFT"
ALIGN="LEFT"
VALIGN="TOP"
VALIGN="TOP"
>The current
>The current
implementation doesn't return this type</TD
implementation doesn't return this type</TD
></TR
></TR
></TBODY
></TBODY
></TABLE
></TABLE
></DIV
></DIV
><P
><P
>X/Open mode is similar except that the message is
>X/Open mode is similar except that the message is
not printed on stderr and HUGE_VAL is used in place of
not printed on stderr and HUGE_VAL is used in place of
HUGE</P
HUGE</P
></DIV
></DIV
><DIV
><DIV
CLASS="SECT2"
CLASS="SECT2"
><H2
><H2
CLASS="SECT2"
CLASS="SECT2"
><A
><A
NAME="AEN10226">Thread-safety and re-entrancy</H2
NAME="AEN10226">Thread-safety and re-entrancy</H2
><P
><P
>With the appropriate configuration options set below, the
>With the appropriate configuration options set below, the
math library is fully thread-safe if:</P
math library is fully thread-safe if:</P
><P
><P
></P
></P
><UL
><UL
><LI
><LI
><P
><P
>Depending on the compatibility mode, the
>Depending on the compatibility mode, the
                setting of the errno variable from the C library is
                setting of the errno variable from the C library is
                thread-safe</P
                thread-safe</P
></LI
></LI
><LI
><LI
><P
><P
>Depending on the compatibility mode, sending error messages
>Depending on the compatibility mode, sending error messages
to the stderr output stream using the C library
to the stderr output stream using the C library
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>fputs()</TT
>fputs()</TT
>
>
 function is thread-safe </P
 function is thread-safe </P
></LI
></LI
><LI
><LI
><P
><P
>Depending on the compatibility mode, the user-supplied
>Depending on the compatibility mode, the user-supplied
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>matherr()</TT
>matherr()</TT
>
>
 function and anything it depends on are thread-safe </P
 function and anything it depends on are thread-safe </P
></LI
></LI
></UL
></UL
><P
><P
>In addition, with the exception of the <TT
>In addition, with the exception of the <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>gamma*()</TT
>gamma*()</TT
> and <TT
> and <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>lgamma*()</TT
>lgamma*()</TT
> functions,
> functions,
the math library is reentrant (and thus safe to use from interrupt handlers)
the math library is reentrant (and thus safe to use from interrupt handlers)
if the Math library is always in IEEE mode.</P
if the Math library is always in IEEE mode.</P
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="c-and-math-library-overview.html"
HREF="c-and-math-library-overview.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="ecos-ref.html"
HREF="ecos-ref.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="libc-implementation-details.html"
HREF="libc-implementation-details.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>C and math library overview</TD
>C and math library overview</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="c-and-math-library-overview.html"
HREF="c-and-math-library-overview.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>Some implementation details</TD
>Some implementation details</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.