Revision: 65240
http://sourceforge.net/p/brlcad/code/65240
Author: carlmoore
Date: 2015-06-10 15:44:37 +0000 (Wed, 10 Jun 2015)
Log Message:
-----------
disallow 0 to negative power
Modified Paths:
--------------
brlcad/trunk/src/util/bwmod.c
Modified: brlcad/trunk/src/util/bwmod.c
===================================================================
--- brlcad/trunk/src/util/bwmod.c 2015-06-10 15:32:42 UTC (rev 65239)
+++ brlcad/trunk/src/util/bwmod.c 2015-06-10 15:44:37 UTC (rev 65240)
@@ -81,15 +81,21 @@
int
checkpow(double x , double exponent)
{
- double diff;
- if (x >= 0.0) return 1;
- diff = exponent - (double)((int)exponent);
- if ( diff < 0.0 || diff > 0.0 ) {
- fprintf(stderr,"bwmod: negative number (%f) to non-integer power
(%f)\n",
- x,exponent);
- bu_exit (-1, NULL);
+ if (x > 0.0) return 1;
+ if (x < 0.0) {
+ double diff;
+ diff = exponent - (double)((int)exponent);
+ if ( diff < 0.0 || diff > 0.0 ) {
+ fprintf(stderr,"bwmod: negative number (%f) to non-integer power
(%f)\n",
+ x,exponent);
+ bu_exit (-1, NULL);
+ }
+ return 1;
}
- return 1;
+/* We have x == 0.0, and we accept that 0 to 0 power is 1. */
+ if (exponent >= 0.0) return 1;
+ fprintf(stderr,"bwmod: zero to negative power (%f)\n",exponent);
+ bu_exit (-1, NULL);
}
int
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits