Bug#667168: fparser gcc 4.7 fix
Scott Howard
showard314 at gmail.com
Wed Apr 4 21:16:00 UTC 2012
tags 667168 patch
thanks
from openSUSE
https://build.opensuse.org/package/view_file?file=gcc47.patch&package=fparser&project=openSUSE%3AFactory
--- extrasrc/fpaux.hh.old 2012-03-21 10:26:04.738031325 +0000
+++ extrasrc/fpaux.hh 2012-03-21 10:51:54.058948092 +0000
@@ -69,13 +69,6 @@ namespace FUNCTIONPARSERTYPES
};
#endif
- // Commented versions in fparser.cc
- template<typename Value_t>
- inline Value_t fp_pow_with_exp_log(const Value_t& x, const Value_t& y)
- {
- return fp_exp(fp_log(x) * y);
- }
-
template<typename Value_t>
inline Value_t fp_powi(Value_t x, unsigned long y)
{
@@ -86,37 +79,7 @@ namespace FUNCTIONPARSERTYPES
else { x *= x; y /= 2; }
}
return result;
- }
-
- template<typename Value_t>
- Value_t fp_pow(const Value_t& x, const Value_t& y)
- {
- if(x == Value_t(1)) return Value_t(1);
- if(isLongInteger(y))
- {
- if(y >= Value_t(0))
- return fp_powi(x, makeLongInteger(y));
- else
- return Value_t(1) / fp_powi(x, -makeLongInteger(y));
- }
- if(y >= Value_t(0))
- {
- if(x > Value_t(0)) return fp_pow_with_exp_log(x, y);
- if(x == Value_t(0)) return Value_t(0);
- if(!isInteger(y*Value_t(16)))
- return -fp_pow_with_exp_log(-x, y);
- }
- else
- {
- if(x > Value_t(0)) return fp_pow_with_exp_log(Value_t(1) / x, -y);
- if(x < Value_t(0))
- {
- if(!isInteger(y*Value_t(-16)))
- return -fp_pow_with_exp_log(Value_t(-1) / x, -y);
- }
- }
- return fp_pow_base(x, y);
- }
+ }
//==========================================================================
// Constants
@@ -327,12 +290,6 @@ namespace FUNCTIONPARSERTYPES
}
template<typename Value_t>
- inline Value_t fp_exp2(const Value_t& x)
- {
- return fp_pow(Value_t(2), x);
- }
-
- template<typename Value_t>
inline Value_t fp_trunc(const Value_t& x)
{
return x < Value_t() ? fp_ceil(x) : fp_floor(x);
@@ -1120,14 +1077,7 @@ namespace FUNCTIONPARSERTYPES
inline bool isInteger(const Value_t& value)
{
return fp_equal(value, fp_floor(value));
- }
-
- // Is value an integer that fits in "long" datatype?
- template<typename Value_t>
- inline bool isLongInteger(const Value_t& value)
- {
- return value == Value_t( makeLongInteger(value) );
- }
+ }
template<typename Value_t>
inline long makeLongInteger(const Value_t& value)
@@ -1227,6 +1177,57 @@ namespace FUNCTIONPARSERTYPES
return value%2 != 0;
}
#endif
+ // Is value an integer that fits in "long" datatype?
+ template<typename Value_t>
+ inline bool isLongInteger(const Value_t& value)
+ {
+ return value == Value_t( makeLongInteger(value) );
+ }
+
+ // Commented versions in fparser.cc
+ template<typename Value_t>
+ inline Value_t fp_pow_with_exp_log(const Value_t& x, const Value_t& y)
+ {
+ return fp_exp(fp_log(x) * y);
+ }
+
+ template<typename Value_t>
+ Value_t fp_pow(const Value_t& x, const Value_t& y)
+ {
+ if(x == Value_t(1)) return Value_t(1);
+ if(isLongInteger(y))
+ {
+ if(y >= Value_t(0))
+ return fp_powi(x, makeLongInteger(y));
+ else
+ return Value_t(1) / fp_powi(x, -makeLongInteger(y));
+ }
+ if(y >= Value_t(0))
+ {
+ if(x > Value_t(0)) return fp_pow_with_exp_log(x, y);
+ if(x == Value_t(0)) return Value_t(0);
+ if(!isInteger(y*Value_t(16)))
+ return -fp_pow_with_exp_log(-x, y);
+ }
+ else
+ {
+ if(x > Value_t(0)) return fp_pow_with_exp_log(Value_t(1) / x, -y);
+ if(x < Value_t(0))
+ {
+ if(!isInteger(y*Value_t(-16)))
+ return -fp_pow_with_exp_log(Value_t(-1) / x, -y);
+ }
+ }
+ return fp_pow_base(x, y);
+ }
+
+ template<typename Value_t>
+ inline Value_t fp_exp2(const Value_t& x)
+ {
+ return fp_pow(Value_t(2), x);
+ }
+
+
} // namespace FUNCTIONPARSERTYPES
#endif // ONCE_FPARSER_H_
More information about the debian-science-maintainers
mailing list