|
From: <and...@us...> - 2008-12-17 21:54:01
|
Revision: 9175
http://plplot.svn.sourceforge.net/plplot/?rev=9175&view=rev
Author: andrewross
Date: 2008-12-17 21:53:57 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
Update C and python versions of example 31 to avoid testing for
equality of real numbers. Rounding errors on some system could cause
these tests to fail erroneously.
Modified Paths:
--------------
trunk/examples/c/x31c.c
trunk/examples/python/xw31.py
Modified: trunk/examples/c/x31c.c
===================================================================
--- trunk/examples/c/x31c.c 2008-12-17 21:52:41 UTC (rev 9174)
+++ trunk/examples/c/x31c.c 2008-12-17 21:53:57 UTC (rev 9175)
@@ -213,7 +213,10 @@
plsdiplz(0.1, 0.1, 0.9, 0.9);
plgdiplt(&zxmin, &zymin, &zxmax, &zymax);
printf("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f \n", zxmin, zymin, zxmax, zymax);
- if (zxmin != xmin + (xmax-xmin)*0.1 || zxmax != xmin+(xmax-xmin)*0.9 || zymin != ymin+(ymax-ymin)*0.1 || zymax != ymin+(ymax-ymin)*0.9) {
+ if ( fabs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0E-5 ||
+ fabs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0E-5 ||
+ fabs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0E-5 ||
+ fabs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 ) {
fputs("plsdiplz test failed\n",stderr);
plend();
exit(1);
Modified: trunk/examples/python/xw31.py
===================================================================
--- trunk/examples/python/xw31.py 2008-12-17 21:52:41 UTC (rev 9174)
+++ trunk/examples/python/xw31.py 2008-12-17 21:53:57 UTC (rev 9175)
@@ -187,7 +187,7 @@
plsdiplz(0.1, 0.1, 0.9, 0.9)
(zxmin, zymin, zxmax, zymax) = plgdiplt()
sys.stdout.write("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f \n" % (zxmin, zymin, zxmax, zymax))
- if zxmin != xmin+(xmax-xmin)*0.1 or zxmax != xmin+(xmax-xmin)*0.9 or zymin != ymin+(ymax-ymin)*0.1 or zymax != ymin+(ymax-ymin)*0.9:
+ if abs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0E-5 or abs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0E-5 or abs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0E-5 or abs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 :
sys.stderr.write("plsdiplz test failed\n")
plend()
sys.exit(1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|