|
From: <ai...@us...> - 2009-08-27 03:41:25
|
Revision: 10351
http://plplot.svn.sourceforge.net/plplot/?rev=10351&view=rev
Author: airwin
Date: 2009-08-27 03:41:19 +0000 (Thu, 27 Aug 2009)
Log Message:
-----------
Guard against floating-point errors in comparison of pos[i] with 0. and 1.
(Thanks to Valery Pipin for testing on hardware where this issue surfaced for
cmap1_default.pal.)
Modified Paths:
--------------
trunk/src/plctrl.c
Modified: trunk/src/plctrl.c
===================================================================
--- trunk/src/plctrl.c 2009-08-27 01:15:25 UTC (rev 10350)
+++ trunk/src/plctrl.c 2009-08-27 03:41:19 UTC (rev 10351)
@@ -1424,11 +1424,15 @@
b[i] = (PLFLT)b_i/255.;
a[i] = 1.0;
pos[i] = 0.01*(PLFLT)pos_i;
- if(pos[i] < 0. || pos[i] > 1.) {
+ if(pos[i] < -1.e-12 || pos[i] > 1. + 1.e-12) {
snprintf(msgbuf,1024,"Unrecognized cmap1 format %s\n", color_info);
plwarn(msgbuf);
err = 1;
break;
+ } else if (pos[i] < 0.) {
+ pos[i] = 0.;
+ } else if (pos[i] > 1.) {
+ pos[i] = 1.;
}
if(return_sscanf == 5) {
/* Next to oldest tk format with rev specified. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|