Patch isgreater.3: add-iseqsig-and-example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



some relationen for floating point values are implemented as macros
add missing iseqsig and try to motivate the rationale with an example

Signed-off-by: Radisson <Radisson97@xxxxxx>
---
 man3/isgreater.3 | 44 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/man3/isgreater.3 b/man3/isgreater.3
index 7c1f2a7c5..10767c393 100644
--- a/man3/isgreater.3
+++ b/man3/isgreater.3
@@ -9,8 +9,8 @@
 .\"
 .TH ISGREATER 3  2021-03-22 "" "Linux Programmer's Manual"
 .SH NAME
-isgreater, isgreaterequal, isless, islessequal, islessgreater,
-isunordered \- floating-point relational tests without exception for NaN
+isgreater, isgreaterequal, isless, islessequal, islessgreater, iseqsig,
+isunordered \- floating-point comparison functions
 .SH SYNOPSIS
 .nf
 .B #include <math.h>
@@ -20,6 +20,7 @@ isunordered \- floating-point relational tests without exception for NaN
 .BI "int isless(" x ", " y );
 .BI "int islessequal(" x ", " y );
 .BI "int islessgreater(" x ", " y );
+.BI "int iseqsig(" x ", " y );
 .BI "int isunordered(" x ", " y );
 .fi
 .PP
@@ -97,6 +98,10 @@ is NaN.
 .BR isunordered ()
 determines whether its arguments are unordered, that is, whether
 at least one of the arguments is a NaN.
+.TP
+.BR iseqsig ()
+determines \fI(x)\ ==\ (y) \fP. It differs from the comparison by
+rasing an exeption if either argument is a NaN.
 .SH RETURN VALUE
 The macros other than
 .BR isunordered ()
@@ -109,6 +114,9 @@ returns 1 if
 or
 .I y
 is NaN and 0 otherwise.
+.PP
+.BR iseqsig ()
+sets errno to EDOM if either argument is a NaN.
 .SH ERRORS
 No errors occur.
 .SH ATTRIBUTES
@@ -127,12 +135,42 @@ T{
 .BR isless (),
 .BR islessequal (),
 .BR islessgreater (),
-.BR isunordered ()
+.BR isunordered (),
+.BR iseqsig ()
 T}	Thread safety	MT-Safe
 .TE
 .hy
 .ad
 .sp 1
+.SH EXAMPLE
+The example demonstates the difference between the equal operator
+and
+.BR iseqsig ().
+The return value is the same but errno is different.
+.EX
+.nf
+/*
+ * gcc -lm iseqsig.c -o  iseqsig
+*/
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+
+int main()
+{
+        double x=0.0/0.0;
+        double y=0.0;
+
+        printf("%d ",x==y);
+        puts(strerror(errno));
+        printf("%d ",iseqsig(x,y));
+        puts(strerror(errno));
+        return 0;
+}
+.fi
+.EE
+
 .SH CONFORMING TO
 POSIX.1-2001, POSIX.1-2008, C99.
 .SH NOTES
--
2.26.2





[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux