All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch isgreater.3: add-iseqsig-and-example
@ 2021-06-09 18:53 Radisson97
  0 siblings, 0 replies; only message in thread
From: Radisson97 @ 2021-06-09 18:53 UTC (permalink / raw)
  To: linux-man


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@gmx.de>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-09 18:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 18:53 Patch isgreater.3: add-iseqsig-and-example Radisson97

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.