1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscIntMultError.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>PetscIntMultError</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.14.5 2021-03-03</b></div>
<div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.14.5 v3.14.5 docs/manualpages/Sys/PetscIntMultError.html "><small>Report Typos and Errors</small></a></div>
<A NAME="PetscIntMultError"><H1>PetscIntMultError</H1></A>
Computes the product of two positive <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> and generates an error with overflow.
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
PETSC_STATIC_INLINE <A HREF="../Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</A> <A HREF="../Sys/PetscIntMultError.html#PetscIntMultError">PetscIntMultError</A>(<A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> a,<A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> b,<A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> *result)
</PRE>
Not Collective
<P>
<H3><FONT COLOR="#CC3333">Input Parameter</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>a </B></TD><TD>- the <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> value
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>b </B></TD><TD>- the second value
</TD></TR></TABLE>
<P>
Output Parameter:ma
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>result </B></TD><TD>- the result as a <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> value, or NULL if you do not want the result, you just want to check if it overflows
</TD></TR></TABLE>
<P>
Use PetscInt64Mult() to compute the product of two 32 bit <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> and store in a PetscInt64
Use <A HREF="../Sys/PetscIntMultTruncate.html#PetscIntMultTruncate">PetscIntMultTruncate</A>() to compute the product of two <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> and truncate it to fit in a <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A>
<P>
Not available from Fortran
<P>
Developers Note: We currently assume that <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A> addition does not overflow, this is obviously wrong but requires many more checks.
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../Sys/PetscBLASInt.html#PetscBLASInt">PetscBLASInt</A>, <A HREF="../Sys/PetscMPIInt.html#PetscMPIInt">PetscMPIInt</A>, <A HREF="../Sys/PetscInt.html#PetscInt">PetscInt</A>, <A HREF="../Sys/PetscBLASIntCast.html#PetscBLASIntCast">PetscBLASIntCast</A>(), PetscIntMult64(), <A HREF="../Sys/PetscIntSumError.html#PetscIntSumError">PetscIntSumError</A>()
<BR><P><B></B><H3><FONT COLOR="#CC3333">Level</FONT></H3>advanced<BR>
<H3><FONT COLOR="#CC3333">Location</FONT></H3>
</B><A HREF="../../../include/petscsys.h.html#PetscIntMultError">include/petscsys.h</A>
<BR><A HREF="./index.html">Index of all Sys routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
</BODY></HTML>
|