summaryrefslogtreecommitdiff
path: root/tests/tcmp_ui.c
diff options
context:
space:
mode:
authorhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>1999-06-09 18:03:33 +0000
committerhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>1999-06-09 18:03:33 +0000
commit0cf5fc5ea4b5ed46b454d3bf3adc620d9fff2d32 (patch)
tree62d12a119f5dfc15abe2f6d298617e174a0a06af /tests/tcmp_ui.c
parent8d21dd7188076894a6f65e510797c8c6928e474f (diff)
downloadmpfr-0cf5fc5ea4b5ed46b454d3bf3adc620d9fff2d32.tar.gz
Initial revision
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp_ui.c')
-rw-r--r--tests/tcmp_ui.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c
new file mode 100644
index 000000000..98642f7ca
--- /dev/null
+++ b/tests/tcmp_ui.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "gmp.h"
+#include "longlong.h"
+#include "mpfr.h"
+
+main()
+{
+ mpfr_t x; unsigned long i; long s;
+
+ mpfr_init(x);
+
+ mpfr_set_ui(x, 3, GMP_RNDZ);
+ if (mpfr_cmp_ui(x, i=3)!=0) {
+ printf("Error in mpfr_cmp_ui(%1.20f,%d)\n",mpfr_get_d(x), i); exit(1);
+ }
+ if (mpfr_cmp_ui(x, i=2)<=0) {
+ printf("Error in mpfr_cmp_ui(%1.20f,%d)\n",mpfr_get_d(x), i); exit(1);
+ }
+ if (mpfr_cmp_ui(x, i=4)>=0) {
+ printf("Error in mpfr_cmp_ui(%1.20f,%d)\n",mpfr_get_d(x), i); exit(1);
+ }
+
+ mpfr_set_si(x, -3, GMP_RNDZ);
+ if (mpfr_cmp_si(x, s=-3)!=0) {
+ printf("Error in mpfr_cmp_si(%1.20f,%d)\n",mpfr_get_d(x), s); exit(1);
+ }
+ if (mpfr_cmp_si(x, i=-4)<=0) {
+ printf("Error in mpfr_cmp_si(%1.20f,%d)\n",mpfr_get_d(x), s); exit(1);
+ }
+ if (mpfr_cmp_si(x, i=1)>=0) {
+ printf("Error in mpfr_cmp_si(%1.20f,%d)\n",mpfr_get_d(x), s); exit(1);
+ }
+}