|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73545 - in sandbox/e_float: boost/e_float libs/e_float/build libs/e_float/src/e_float libs/e_float/src/e_float/efx libs/e_float/src/e_float/mpfr libs/e_float/src/functions/elementary
From: e_float_at_[hidden]
Date: 2011-08-05 08:53:13
Author: christopher_kormanyos
Date: 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
New Revision: 73545
URL: http://svn.boost.org/trac/boost/changeset/73545
Log:
- Added global ops with plain char.
- Brought the mpfr::e_float back-end into conformance with global ops.
Text files modified:
sandbox/e_float/boost/e_float/e_float_base.hpp | 6 +
sandbox/e_float/boost/e_float/e_float_complex.hpp | 37 +++++++----
sandbox/e_float/boost/e_float/e_float_elementary_complex.hpp | 12 +++
sandbox/e_float/boost/e_float/e_float_global_math.hpp | 73 +++++++++++++----------
sandbox/e_float/boost/e_float/e_float_mpfr.hpp | 32 ++++++---
sandbox/e_float/libs/e_float/build/e_float.vcxproj | 1
sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp | 43 +++++++------
sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp | 8 +
sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr.cpp | 121 +++++++++++++++++++++++++++++----------
sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr_protos.h | 8 +
sandbox/e_float/libs/e_float/src/functions/elementary/elementary_trans.cpp | 15 ----
11 files changed, 228 insertions(+), 128 deletions(-)
Modified: sandbox/e_float/boost/e_float/e_float_base.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_base.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_base.hpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -123,6 +123,9 @@
virtual bool rd_string(const char* const) = 0;
// Specific higher functions which might be present in the MP implementation.
+ virtual bool has_its_own_ldexp (void) const { return false; }
+ virtual bool has_its_own_frexp (void) const { return false; }
+ virtual bool has_its_own_fmod (void) const { return false; }
virtual bool has_its_own_cbrt (void) const { return false; }
virtual bool has_its_own_rootn (void) const { return false; }
virtual bool has_its_own_exp (void) const { return false; }
@@ -144,6 +147,9 @@
virtual bool has_its_own_cyl_bessel_jn(void) const { return false; }
virtual bool has_its_own_cyl_bessel_yn(void) const { return false; }
+ static e_float my_ldexp (const e_float&, int);
+ static e_float my_frexp (const e_float&, int*);
+ static e_float my_fmod (const e_float&, const e_float&);
static e_float my_cbrt (const e_float&);
static e_float my_rootn (const e_float&, const UINT32);
static e_float my_exp (const e_float&);
Modified: sandbox/e_float/boost/e_float/e_float_complex.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_complex.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_complex.hpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -24,6 +24,7 @@
class ef_complex;
+ inline ef_complex& operator+=(ef_complex&, const char);
inline ef_complex& operator+=(ef_complex&, const signed char);
inline ef_complex& operator+=(ef_complex&, const signed short);
inline ef_complex& operator+=(ef_complex&, const signed int);
@@ -39,6 +40,7 @@
inline ef_complex& operator+=(ef_complex&, const double);
inline ef_complex& operator+=(ef_complex&, const long double);
+ inline ef_complex& operator-=(ef_complex&, const char);
inline ef_complex& operator-=(ef_complex&, const signed char);
inline ef_complex& operator-=(ef_complex&, const signed short);
inline ef_complex& operator-=(ef_complex&, const signed int);
@@ -54,6 +56,7 @@
inline ef_complex& operator-=(ef_complex&, const double);
inline ef_complex& operator-=(ef_complex&, const long double);
+ inline ef_complex& operator*=(ef_complex&, const char);
inline ef_complex& operator*=(ef_complex&, const signed char);
inline ef_complex& operator*=(ef_complex&, const signed short);
inline ef_complex& operator*=(ef_complex&, const signed int);
@@ -69,6 +72,7 @@
inline ef_complex& operator*=(ef_complex&, const double);
inline ef_complex& operator*=(ef_complex&, const long double);
+ inline ef_complex& operator/=(ef_complex&, const char);
inline ef_complex& operator/=(ef_complex&, const signed char);
inline ef_complex& operator/=(ef_complex&, const signed short);
inline ef_complex& operator/=(ef_complex&, const signed int);
@@ -115,7 +119,9 @@
explicit ef_complex(const char* const s) : Re(s), Im(ef::zero()) { }
explicit ef_complex(const std::string& str) : Re(str), Im(ef::zero()) { }
- ef_complex(const e_float& re = e_float(), const e_float& im = e_float()) : Re(re), Im(im) { }
+ ef_complex() { }
+ ef_complex(const e_float& re) : Re(re), Im(ef::zero()) { }
+ ef_complex(const e_float& re, const e_float& im) : Re(re), Im(im) { }
ef_complex(const ef_complex& z) : Re(z.Re), Im(z.Im) { }
e_float real(void) const { return Re; }
@@ -126,31 +132,28 @@
e_float norm(void) const { return (Re * Re) + (Im * Im); }
- ef_complex& operator=(const ef_complex& v) { Re = v.Re; Im = v.Im; return *this; }
+ ef_complex& operator=(const ef_complex& v) { Re = v.Re; Im = v.Im; return *this; }
+ ef_complex& operator=(const e_float& v) { Re = v; Im = ef::zero(); return *this; }
+
ef_complex& operator+=(const ef_complex& v) { Re += v.Re; Im += v.Im; return *this; }
ef_complex& operator-=(const ef_complex& v) { Re -= v.Re; Im -= v.Im; return *this; }
ef_complex& operator*=(const ef_complex& v)
{
- const e_float re = (Re * v.Re) - (Im * v.Im);
- const e_float im = (Re * v.Im) + (Im * v.Re);
-
- Re = re;
- Im = im;
-
+ const e_float tmp_re = (Re * v.Re) - (Im * v.Im);
+ const e_float tmp_im = (Re * v.Im) + (Im * v.Re);
+ Re = tmp_re;
+ Im = tmp_im;
return *this;
}
ef_complex& operator/=(const ef_complex& v)
{
const e_float one_over_denom = ef::one() / v.norm();
-
- const e_float re = ((Re * v.Re) + (Im * v.Im)) * one_over_denom;
- const e_float im = ((Im * v.Re) - (Re * v.Im)) * one_over_denom;
-
- Re = re;
- Im = im;
-
+ const e_float tmp_re = ((Re * v.Re) + (Im * v.Im)) * one_over_denom;
+ const e_float tmp_im = ((Im * v.Re) - (Re * v.Im)) * one_over_denom;
+ Re = tmp_re;
+ Im = tmp_im;
return *this;
}
@@ -167,6 +170,7 @@
bool isone (void) const { return Re.isone() && Im.iszero(); }
bool iszero (void) const { return Re.iszero() && Im.iszero(); }
+ friend inline ef_complex& ::operator+=(ef_complex&, const char);
friend inline ef_complex& ::operator+=(ef_complex&, const signed char);
friend inline ef_complex& ::operator+=(ef_complex&, const signed short);
friend inline ef_complex& ::operator+=(ef_complex&, const signed int);
@@ -182,6 +186,7 @@
friend inline ef_complex& ::operator+=(ef_complex&, const double);
friend inline ef_complex& ::operator+=(ef_complex&, const long double);
+ friend inline ef_complex& ::operator-=(ef_complex&, const char);
friend inline ef_complex& ::operator-=(ef_complex&, const signed char);
friend inline ef_complex& ::operator-=(ef_complex&, const signed short);
friend inline ef_complex& ::operator-=(ef_complex&, const signed int);
@@ -197,6 +202,7 @@
friend inline ef_complex& ::operator-=(ef_complex&, const double);
friend inline ef_complex& ::operator-=(ef_complex&, const long double);
+ friend inline ef_complex& ::operator*=(ef_complex&, const char);
friend inline ef_complex& ::operator*=(ef_complex&, const signed char);
friend inline ef_complex& ::operator*=(ef_complex&, const signed short);
friend inline ef_complex& ::operator*=(ef_complex&, const signed int);
@@ -212,6 +218,7 @@
friend inline ef_complex& ::operator*=(ef_complex&, const double);
friend inline ef_complex& ::operator*=(ef_complex&, const long double);
+ friend inline ef_complex& ::operator/=(ef_complex&, const char);
friend inline ef_complex& ::operator/=(ef_complex&, const signed char);
friend inline ef_complex& ::operator/=(ef_complex&, const signed short);
friend inline ef_complex& ::operator/=(ef_complex&, const signed int);
Modified: sandbox/e_float/boost/e_float/e_float_elementary_complex.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_elementary_complex.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_elementary_complex.hpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -89,6 +89,7 @@
inline ef_complex operator/(const e_float& u, const ef_complex& v) { const e_float v_norm = v.norm(); return ef_complex((u * v.real()) / v_norm, (-u * v.imag()) / v_norm); }
// Global add/sub/mul/div of const ef_complex& with all built-in types.
+ inline ef_complex operator+(const ef_complex& z, const char n) { return ef_complex(z.real() + n, z.imag()); }
inline ef_complex operator+(const ef_complex& z, const signed char n) { return ef_complex(z.real() + n, z.imag()); }
inline ef_complex operator+(const ef_complex& z, const signed short n) { return ef_complex(z.real() + n, z.imag()); }
inline ef_complex operator+(const ef_complex& z, const signed int n) { return ef_complex(z.real() + n, z.imag()); }
@@ -104,6 +105,7 @@
inline ef_complex operator+(const ef_complex& z, const double d) { return ef_complex(z.real() + d, z.imag()); }
inline ef_complex operator+(const ef_complex& z, const long double ld) { return ef_complex(z.real() + ld, z.imag()); }
+ inline ef_complex operator-(const ef_complex& z, const char n) { return ef_complex(z.real() - n, z.imag()); }
inline ef_complex operator-(const ef_complex& z, const signed char n) { return ef_complex(z.real() - n, z.imag()); }
inline ef_complex operator-(const ef_complex& z, const signed short n) { return ef_complex(z.real() - n, z.imag()); }
inline ef_complex operator-(const ef_complex& z, const signed int n) { return ef_complex(z.real() - n, z.imag()); }
@@ -119,6 +121,7 @@
inline ef_complex operator-(const ef_complex& z, const double d) { return ef_complex(z.real() - d, z.imag()); }
inline ef_complex operator-(const ef_complex& z, const long double ld) { return ef_complex(z.real() - ld, z.imag()); }
+ inline ef_complex operator*(const ef_complex& z, const char n) { return ef_complex(z.real() * n, z.imag() * n); }
inline ef_complex operator*(const ef_complex& z, const signed char n) { return ef_complex(z.real() * n, z.imag() * n); }
inline ef_complex operator*(const ef_complex& z, const signed short n) { return ef_complex(z.real() * n, z.imag() * n); }
inline ef_complex operator*(const ef_complex& z, const signed int n) { return ef_complex(z.real() * n, z.imag() * n); }
@@ -134,6 +137,7 @@
inline ef_complex operator*(const ef_complex& z, const double d) { return ef_complex(z.real() * d, z.imag() * d); }
inline ef_complex operator*(const ef_complex& z, const long double ld) { return ef_complex(z.real() * ld, z.imag() * ld); }
+ inline ef_complex operator/(const ef_complex& z, const char n) { return ef_complex(z.real() / n, z.imag() / n); }
inline ef_complex operator/(const ef_complex& z, const signed char n) { return ef_complex(z.real() / n, z.imag() / n); }
inline ef_complex operator/(const ef_complex& z, const signed short n) { return ef_complex(z.real() / n, z.imag() / n); }
inline ef_complex operator/(const ef_complex& z, const signed int n) { return ef_complex(z.real() / n, z.imag() / n); }
@@ -150,6 +154,7 @@
inline ef_complex operator/(const ef_complex& z, const long double ld) { return ef_complex(z.real() / ld, z.imag() / ld); }
// Global add/sub/mul/div of all built-in types with const ef_complex&.
+ inline ef_complex operator+(const char n, const ef_complex& v) { return ef_complex(v.real() + n, v.imag()); }
inline ef_complex operator+(const signed char n, const ef_complex& v) { return ef_complex(v.real() + n, v.imag()); }
inline ef_complex operator+(const signed short n, const ef_complex& v) { return ef_complex(v.real() + n, v.imag()); }
inline ef_complex operator+(const signed int n, const ef_complex& v) { return ef_complex(v.real() + n, v.imag()); }
@@ -165,6 +170,7 @@
inline ef_complex operator+(const double d, const ef_complex& v) { return ef_complex(v.real() + d, v.imag() + d); }
inline ef_complex operator+(const long double ld, const ef_complex& v) { return ef_complex(v.real() + ld, v.imag() + ld); }
+ inline ef_complex operator-(const char n, const ef_complex& v) { return ef_complex(n - v.real(), -v.imag()); }
inline ef_complex operator-(const signed char n, const ef_complex& v) { return ef_complex(n - v.real(), -v.imag()); }
inline ef_complex operator-(const signed short n, const ef_complex& v) { return ef_complex(n - v.real(), -v.imag()); }
inline ef_complex operator-(const signed int n, const ef_complex& v) { return ef_complex(n - v.real(), -v.imag()); }
@@ -180,6 +186,7 @@
inline ef_complex operator-(const double d, const ef_complex& v) { return ef_complex(d - v.real(), -v.imag()); }
inline ef_complex operator-(const long double ld, const ef_complex& v) { return ef_complex(ld - v.real(), -v.imag()); }
+ inline ef_complex operator*(const char n, const ef_complex& v) { return ef_complex(v.real() * n, v.imag() * n); }
inline ef_complex operator*(const signed char n, const ef_complex& v) { return ef_complex(v.real() * n, v.imag() * n); }
inline ef_complex operator*(const signed short n, const ef_complex& v) { return ef_complex(v.real() * n, v.imag() * n); }
inline ef_complex operator*(const signed int n, const ef_complex& v) { return ef_complex(v.real() * n, v.imag() * n); }
@@ -195,6 +202,7 @@
inline ef_complex operator*(const double d, const ef_complex& v) { return ef_complex(v.real() * d, v.imag() * d); }
inline ef_complex operator*(const long double ld, const ef_complex& v) { return ef_complex(v.real() * ld, v.imag() * ld); }
+ inline ef_complex operator/(const char n, const ef_complex& v) { const e_float v_norm = v.norm(); return ef_complex((n * v.real()) / v_norm, -(n * v.imag()) / v_norm); }
inline ef_complex operator/(const signed char n, const ef_complex& v) { const e_float v_norm = v.norm(); return ef_complex((n * v.real()) / v_norm, -(n * v.imag()) / v_norm); }
inline ef_complex operator/(const signed short n, const ef_complex& v) { const e_float v_norm = v.norm(); return ef_complex((n * v.real()) / v_norm, -(n * v.imag()) / v_norm); }
inline ef_complex operator/(const signed int n, const ef_complex& v) { const e_float v_norm = v.norm(); return ef_complex((n * v.real()) / v_norm, -(n * v.imag()) / v_norm); }
@@ -211,6 +219,7 @@
inline ef_complex operator/(const long double ld, const ef_complex& v) { const e_float v_norm = v.norm(); return ef_complex((ld * v.real()) / v_norm, -(ld * v.imag()) / v_norm); }
// Global self add/sub/mul/div of ef_complex& with all built-in types.
+ inline ef_complex& operator+=(ef_complex& z, const char n) { z.Re += n; return z; }
inline ef_complex& operator+=(ef_complex& z, const signed char n) { z.Re += n; return z; }
inline ef_complex& operator+=(ef_complex& z, const signed short n) { z.Re += n; return z; }
inline ef_complex& operator+=(ef_complex& z, const signed int n) { z.Re += n; return z; }
@@ -226,6 +235,7 @@
inline ef_complex& operator+=(ef_complex& z, const double d) { z.Re += d; return z; }
inline ef_complex& operator+=(ef_complex& z, const long double ld) { z.Re += ld; return z; }
+ inline ef_complex& operator-=(ef_complex& z, const char n) { z.Re -= n; return z; }
inline ef_complex& operator-=(ef_complex& z, const signed char n) { z.Re -= n; return z; }
inline ef_complex& operator-=(ef_complex& z, const signed short n) { z.Re -= n; return z; }
inline ef_complex& operator-=(ef_complex& z, const signed int n) { z.Re -= n; return z; }
@@ -241,6 +251,7 @@
inline ef_complex& operator-=(ef_complex& z, const double d) { z.Re -= d; return z; }
inline ef_complex& operator-=(ef_complex& z, const long double ld) { z.Re -= ld; return z; }
+ inline ef_complex& operator*=(ef_complex& z, const char n) { z.Re *= n; z.Im *= n; return z; }
inline ef_complex& operator*=(ef_complex& z, const signed char n) { z.Re *= n; z.Im *= n; return z; }
inline ef_complex& operator*=(ef_complex& z, const signed short n) { z.Re *= n; z.Im *= n; return z; }
inline ef_complex& operator*=(ef_complex& z, const signed int n) { z.Re *= n; z.Im *= n; return z; }
@@ -256,6 +267,7 @@
inline ef_complex& operator*=(ef_complex& z, const double d) { z.Re *= d; z.Im *= d; return z; }
inline ef_complex& operator*=(ef_complex& z, const long double ld) { z.Re *= ld; z.Im *= ld; return z; }
+ inline ef_complex& operator/=(ef_complex& z, const char n) { z.Re /= n; z.Im /= n; return z; }
inline ef_complex& operator/=(ef_complex& z, const signed char n) { z.Re /= n; z.Im /= n; return z; }
inline ef_complex& operator/=(ef_complex& z, const signed short n) { z.Re /= n; z.Im /= n; return z; }
inline ef_complex& operator/=(ef_complex& z, const signed int n) { z.Re /= n; z.Im /= n; return z; }
Modified: sandbox/e_float/boost/e_float/e_float_global_math.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_global_math.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_global_math.hpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -33,13 +33,14 @@
inline e_float operator/(const e_float& u, const e_float& v) { return e_float(u) /= v; }
// Global add/sub/mul/div of const e_float& with all built-in types.
- inline e_float operator+(const e_float& u, const signed char n) { return e_float(u).add_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator+(const e_float& u, const signed short n) { return e_float(u).add_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator+(const e_float& u, const signed int n) { return e_float(u).add_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator+(const e_float& u, const signed long n) { return e_float(u).add_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator+(const e_float& u, const signed long long n) { return e_float(u).add_signed_long_long (static_cast< signed long long>(n)); }
+ inline e_float operator+(const e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).add_signed_long_long(static_cast<signed long long>(n))); }
+ inline e_float operator+(const e_float& u, const signed char n) { return e_float(u).add_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator+(const e_float& u, const signed short n) { return e_float(u).add_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator+(const e_float& u, const signed int n) { return e_float(u).add_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator+(const e_float& u, const signed long n) { return e_float(u).add_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator+(const e_float& u, const signed long long n) { return e_float(u).add_signed_long_long(static_cast<signed long long>(n)); }
inline e_float operator+(const e_float& u, const unsigned char n) { return e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)); }
- inline e_float operator+(const e_float& u, const wchar_t n) { return e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)); }
+ inline e_float operator+(const e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).add_signed_long_long(static_cast<signed long long>(n))); }
inline e_float operator+(const e_float& u, const unsigned short n) { return e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator+(const e_float& u, const unsigned int n) { return e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator+(const e_float& u, const unsigned long n) { return e_float(u).add_unsigned_long_long(static_cast<unsigned long long>(n)); }
@@ -48,13 +49,14 @@
inline e_float operator+(const e_float& u, const double d) { return e_float(u) += e_float(d); }
inline e_float operator+(const e_float& u, const long double ld) { return e_float(u) += e_float(ld); }
- inline e_float operator-(const e_float& u, const signed char n) { return e_float(u).sub_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator-(const e_float& u, const signed short n) { return e_float(u).sub_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator-(const e_float& u, const signed int n) { return e_float(u).sub_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator-(const e_float& u, const signed long n) { return e_float(u).sub_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator-(const e_float& u, const signed long long n) { return e_float(u).sub_signed_long_long (static_cast< signed long long>(n)); }
+ inline e_float operator-(const e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).sub_signed_long_long(static_cast<signed long long>(n))); }
+ inline e_float operator-(const e_float& u, const signed char n) { return e_float(u).sub_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator-(const e_float& u, const signed short n) { return e_float(u).sub_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator-(const e_float& u, const signed int n) { return e_float(u).sub_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator-(const e_float& u, const signed long n) { return e_float(u).sub_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator-(const e_float& u, const signed long long n) { return e_float(u).sub_signed_long_long(static_cast<signed long long>(n)); }
inline e_float operator-(const e_float& u, const unsigned char n) { return e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)); }
- inline e_float operator-(const e_float& u, const wchar_t n) { return e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)); }
+ inline e_float operator-(const e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).sub_signed_long_long(static_cast<signed long long>(n))); }
inline e_float operator-(const e_float& u, const unsigned short n) { return e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator-(const e_float& u, const unsigned int n) { return e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator-(const e_float& u, const unsigned long n) { return e_float(u).sub_unsigned_long_long(static_cast<unsigned long long>(n)); }
@@ -63,13 +65,14 @@
inline e_float operator-(const e_float& u, const double d) { return e_float(u) -= e_float(d); }
inline e_float operator-(const e_float& u, const long double ld) { return e_float(u) -= e_float(ld); }
- inline e_float operator*(const e_float& u, const signed char n) { return e_float(u).mul_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator*(const e_float& u, const signed short n) { return e_float(u).mul_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator*(const e_float& u, const signed int n) { return e_float(u).mul_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator*(const e_float& u, const signed long n) { return e_float(u).mul_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator*(const e_float& u, const signed long long n) { return e_float(u).mul_signed_long_long (static_cast< signed long long>(n)); }
+ inline e_float operator*(const e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).mul_signed_long_long(static_cast<signed long long>(n))); }
+ inline e_float operator*(const e_float& u, const signed char n) { return e_float(u).mul_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator*(const e_float& u, const signed short n) { return e_float(u).mul_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator*(const e_float& u, const signed int n) { return e_float(u).mul_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator*(const e_float& u, const signed long n) { return e_float(u).mul_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator*(const e_float& u, const signed long long n) { return e_float(u).mul_signed_long_long(static_cast<signed long long>(n)); }
inline e_float operator*(const e_float& u, const unsigned char n) { return e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)); }
- inline e_float operator*(const e_float& u, const wchar_t n) { return e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)); }
+ inline e_float operator*(const e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).mul_signed_long_long(static_cast<signed long long>(n))); }
inline e_float operator*(const e_float& u, const unsigned short n) { return e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator*(const e_float& u, const unsigned int n) { return e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator*(const e_float& u, const unsigned long n) { return e_float(u).mul_unsigned_long_long(static_cast<unsigned long long>(n)); }
@@ -78,13 +81,14 @@
inline e_float operator*(const e_float& u, const double d) { return e_float(u) *= e_float(d); }
inline e_float operator*(const e_float& u, const long double ld) { return e_float(u) *= e_float(ld); }
- inline e_float operator/(const e_float& u, const signed char n) { return e_float(u).div_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator/(const e_float& u, const signed short n) { return e_float(u).div_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator/(const e_float& u, const signed int n) { return e_float(u).div_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator/(const e_float& u, const signed long n) { return e_float(u).div_signed_long_long (static_cast< signed long long>(n)); }
- inline e_float operator/(const e_float& u, const signed long long n) { return e_float(u).div_signed_long_long (static_cast< signed long long>(n)); }
+ inline e_float operator/(const e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).div_signed_long_long(static_cast<signed long long>(n))); }
+ inline e_float operator/(const e_float& u, const signed char n) { return e_float(u).div_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator/(const e_float& u, const signed short n) { return e_float(u).div_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator/(const e_float& u, const signed int n) { return e_float(u).div_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator/(const e_float& u, const signed long n) { return e_float(u).div_signed_long_long(static_cast<signed long long>(n)); }
+ inline e_float operator/(const e_float& u, const signed long long n) { return e_float(u).div_signed_long_long(static_cast<signed long long>(n)); }
inline e_float operator/(const e_float& u, const unsigned char n) { return e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)); }
- inline e_float operator/(const e_float& u, const wchar_t n) { return e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)); }
+ inline e_float operator/(const e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)) : e_float(u).div_signed_long_long(static_cast<signed long long>(n))); }
inline e_float operator/(const e_float& u, const unsigned short n) { return e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator/(const e_float& u, const unsigned int n) { return e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)); }
inline e_float operator/(const e_float& u, const unsigned long n) { return e_float(u).div_unsigned_long_long(static_cast<unsigned long long>(n)); }
@@ -94,13 +98,14 @@
inline e_float operator/(const e_float& u, const long double ld) { return e_float(u) /= e_float(ld); }
// Global add/sub/mul/div of all built-in types with const e_float&.
+ inline e_float operator+(const char n, const e_float& u) { return ((!std::numeric_limits<char>::is_signed) ? e_float(u).add_unsigned_long_long(n) : e_float(u).add_signed_long_long(n)); }
inline e_float operator+(const signed char n, const e_float& u) { return e_float(u).add_signed_long_long(n); }
inline e_float operator+(const signed short n, const e_float& u) { return e_float(u).add_signed_long_long(n); }
inline e_float operator+(const signed int n, const e_float& u) { return e_float(u).add_signed_long_long(n); }
inline e_float operator+(const signed long n, const e_float& u) { return e_float(u).add_signed_long_long(n); }
inline e_float operator+(const signed long long n, const e_float& u) { return e_float(u).add_signed_long_long(n); }
inline e_float operator+(const unsigned char n, const e_float& u) { return e_float(u).add_unsigned_long_long(n); }
- inline e_float operator+(const wchar_t n, const e_float& u) { return e_float(u).add_unsigned_long_long(n); }
+ inline e_float operator+(const wchar_t n, const e_float& u) { return ((!std::numeric_limits<wchar_t>::is_signed) ? e_float(u).add_unsigned_long_long(n) : e_float(u).add_signed_long_long(n)); }
inline e_float operator+(const unsigned short n, const e_float& u) { return e_float(u).add_unsigned_long_long(n); }
inline e_float operator+(const unsigned int n, const e_float& u) { return e_float(u).add_unsigned_long_long(n); }
inline e_float operator+(const unsigned long n, const e_float& u) { return e_float(u).add_unsigned_long_long(n); }
@@ -109,6 +114,7 @@
inline e_float operator+(const double d, const e_float& u) { return e_float(d) += u; }
inline e_float operator+(const long double ld, const e_float& u) { return e_float(ld) += u; }
+ inline e_float operator-(const char n, const e_float& u) { return e_float(n) -= u; }
inline e_float operator-(const signed char n, const e_float& u) { return e_float(n) -= u; }
inline e_float operator-(const signed short n, const e_float& u) { return e_float(n) -= u; }
inline e_float operator-(const signed int n, const e_float& u) { return e_float(n) -= u; }
@@ -124,13 +130,14 @@
inline e_float operator-(const double d, const e_float& u) { return e_float(d) -= u; }
inline e_float operator-(const long double ld, const e_float& u) { return e_float(ld) -= u; }
+ inline e_float operator*(const char n, const e_float& u) { return ((!std::numeric_limits<char>::is_signed) ? e_float(u).mul_unsigned_long_long(n) : e_float(u).mul_signed_long_long(n)); }
inline e_float operator*(const signed char n, const e_float& u) { return e_float(u).mul_signed_long_long(n); }
inline e_float operator*(const signed short n, const e_float& u) { return e_float(u).mul_signed_long_long(n); }
inline e_float operator*(const signed int n, const e_float& u) { return e_float(u).mul_signed_long_long(n); }
inline e_float operator*(const signed long n, const e_float& u) { return e_float(u).mul_signed_long_long(n); }
inline e_float operator*(const signed long long n, const e_float& u) { return e_float(u).mul_signed_long_long(n); }
inline e_float operator*(const unsigned char n, const e_float& u) { return e_float(u).mul_unsigned_long_long(n); }
- inline e_float operator*(const wchar_t n, const e_float& u) { return e_float(u).mul_unsigned_long_long(n); }
+ inline e_float operator*(const wchar_t n, const e_float& u) { return ((!std::numeric_limits<wchar_t>::is_signed) ? e_float(u).mul_unsigned_long_long(n) : e_float(u).mul_signed_long_long(n)); }
inline e_float operator*(const unsigned short n, const e_float& u) { return e_float(u).mul_unsigned_long_long(n); }
inline e_float operator*(const unsigned int n, const e_float& u) { return e_float(u).mul_unsigned_long_long(n); }
inline e_float operator*(const unsigned long n, const e_float& u) { return e_float(u).mul_unsigned_long_long(n); }
@@ -139,6 +146,7 @@
inline e_float operator*(const double d, const e_float& u) { return e_float(d) *= u; }
inline e_float operator*(const long double ld, const e_float& u) { return e_float(ld) *= u; }
+ inline e_float operator/(const char n, const e_float& u) { return e_float(n) /= u; }
inline e_float operator/(const signed char n, const e_float& u) { return e_float(n) /= u; }
inline e_float operator/(const signed short n, const e_float& u) { return e_float(n) /= u; }
inline e_float operator/(const signed int n, const e_float& u) { return e_float(n) /= u; }
@@ -155,13 +163,14 @@
inline e_float operator/(const long double ld, const e_float& u) { return e_float(ld) /= u; }
// Global self add/sub/mul/div of e_float& with all built-in types.
+ inline e_float& operator+=(e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? u.add_unsigned_long_long(static_cast<unsigned long long>(n)) : u.add_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator+=(e_float& u, const signed char n) { return u.add_signed_long_long(n); }
inline e_float& operator+=(e_float& u, const signed short n) { return u.add_signed_long_long(n); }
inline e_float& operator+=(e_float& u, const signed int n) { return u.add_signed_long_long(n); }
inline e_float& operator+=(e_float& u, const signed long n) { return u.add_signed_long_long(n); }
inline e_float& operator+=(e_float& u, const signed long long n) { return u.add_signed_long_long(n); }
inline e_float& operator+=(e_float& u, const unsigned char n) { return u.add_unsigned_long_long(n); }
- inline e_float& operator+=(e_float& u, const wchar_t n) { return u.add_unsigned_long_long(n); }
+ inline e_float& operator+=(e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? u.add_unsigned_long_long(static_cast<unsigned long long>(n)) : u.add_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator+=(e_float& u, const unsigned short n) { return u.add_unsigned_long_long(n); }
inline e_float& operator+=(e_float& u, const unsigned int n) { return u.add_unsigned_long_long(n); }
inline e_float& operator+=(e_float& u, const unsigned long n) { return u.add_unsigned_long_long(n); }
@@ -170,13 +179,13 @@
inline e_float& operator+=(e_float& u, const double d) { return u += e_float(d); }
inline e_float& operator+=(e_float& u, const long double ld) { return u += e_float(ld); }
- inline e_float& operator-=(e_float& u, const signed char n) { return u.sub_signed_long_long(n); }
+ inline e_float& operator-=(e_float& u, const signed char n) { return ((!std::numeric_limits<char>::is_signed) ? u.sub_unsigned_long_long(static_cast<unsigned long long>(n)) : u.sub_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator-=(e_float& u, const signed short n) { return u.sub_signed_long_long(n); }
inline e_float& operator-=(e_float& u, const signed int n) { return u.sub_signed_long_long(n); }
inline e_float& operator-=(e_float& u, const signed long n) { return u.sub_signed_long_long(n); }
inline e_float& operator-=(e_float& u, const signed long long n) { return u.sub_signed_long_long(n); }
inline e_float& operator-=(e_float& u, const unsigned char n) { return u.sub_unsigned_long_long(n); }
- inline e_float& operator-=(e_float& u, const wchar_t n) { return u.sub_unsigned_long_long(n); }
+ inline e_float& operator-=(e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? u.sub_unsigned_long_long(static_cast<unsigned long long>(n)) : u.sub_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator-=(e_float& u, const unsigned short n) { return u.sub_unsigned_long_long(n); }
inline e_float& operator-=(e_float& u, const unsigned int n) { return u.sub_unsigned_long_long(n); }
inline e_float& operator-=(e_float& u, const unsigned long n) { return u.sub_unsigned_long_long(n); }
@@ -185,13 +194,14 @@
inline e_float& operator-=(e_float& u, const double d) { return u -= e_float(d); }
inline e_float& operator-=(e_float& u, const long double ld) { return u -= e_float(ld); }
+ inline e_float& operator*=(e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? u.mul_unsigned_long_long(static_cast<unsigned long long>(n)) : u.mul_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator*=(e_float& u, const signed char n) { return u.mul_signed_long_long(n); }
inline e_float& operator*=(e_float& u, const signed short n) { return u.mul_signed_long_long(n); }
inline e_float& operator*=(e_float& u, const signed int n) { return u.mul_signed_long_long(n); }
inline e_float& operator*=(e_float& u, const signed long n) { return u.mul_signed_long_long(n); }
inline e_float& operator*=(e_float& u, const signed long long n) { return u.mul_signed_long_long(n); }
inline e_float& operator*=(e_float& u, const unsigned char n) { return u.mul_unsigned_long_long(n); }
- inline e_float& operator*=(e_float& u, const wchar_t n) { return u.mul_unsigned_long_long(n); }
+ inline e_float& operator*=(e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? u.mul_unsigned_long_long(static_cast<unsigned long long>(n)) : u.mul_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator*=(e_float& u, const unsigned short n) { return u.mul_unsigned_long_long(n); }
inline e_float& operator*=(e_float& u, const unsigned int n) { return u.mul_unsigned_long_long(n); }
inline e_float& operator*=(e_float& u, const unsigned long n) { return u.mul_unsigned_long_long(n); }
@@ -200,13 +210,14 @@
inline e_float& operator*=(e_float& u, const double d) { return u *= e_float(d); }
inline e_float& operator*=(e_float& u, const long double ld) { return u *= e_float(ld); }
+ inline e_float& operator/=(e_float& u, const char n) { return ((!std::numeric_limits<char>::is_signed) ? u.div_unsigned_long_long(static_cast<unsigned long long>(n)) : u.div_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator/=(e_float& u, const signed char n) { return u.div_signed_long_long(n); }
inline e_float& operator/=(e_float& u, const signed short n) { return u.div_signed_long_long(n); }
inline e_float& operator/=(e_float& u, const signed int n) { return u.div_signed_long_long(n); }
inline e_float& operator/=(e_float& u, const signed long n) { return u.div_signed_long_long(n); }
inline e_float& operator/=(e_float& u, const signed long long n) { return u.div_signed_long_long(n); }
inline e_float& operator/=(e_float& u, const unsigned char n) { return u.div_unsigned_long_long(n); }
- inline e_float& operator/=(e_float& u, const wchar_t n) { return u.div_unsigned_long_long(n); }
+ inline e_float& operator/=(e_float& u, const wchar_t n) { return ((!std::numeric_limits<wchar_t>::is_signed) ? u.div_unsigned_long_long(static_cast<unsigned long long>(n)) : u.div_signed_long_long(static_cast<signed long long>(n))); }
inline e_float& operator/=(e_float& u, const unsigned short n) { return u.div_unsigned_long_long(n); }
inline e_float& operator/=(e_float& u, const unsigned int n) { return u.div_unsigned_long_long(n); }
inline e_float& operator/=(e_float& u, const unsigned long n) { return u.div_unsigned_long_long(n); }
Modified: sandbox/e_float/boost/e_float/e_float_mpfr.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_mpfr.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_mpfr.hpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -85,16 +85,25 @@
public:
e_float();
- e_float(const INT32 n);
- e_float(const INT64 n);
- e_float(const UINT32 u);
- e_float(const UINT64 u);
+ e_float(const char n);
+ e_float(const signed char n);
+ e_float(const unsigned char n);
+ e_float(const wchar_t n);
+ e_float(const signed short n);
+ e_float(const unsigned short n);
+ e_float(const signed int n);
+ e_float(const unsigned int n);
+ e_float(const signed long n);
+ e_float(const unsigned long n);
+ e_float(const signed long long n);
+ e_float(const unsigned long long n);
+ e_float(const float f);
e_float(const double d);
- e_float(const char* s);
+ e_float(const long double ld);
+ e_float(const char* const s);
e_float(const std::string& str);
e_float(const e_float& f);
-
e_float(const double mantissa, const INT64 exponent);
virtual ~e_float();
@@ -104,8 +113,8 @@
static void init(void);
- void from_uint64(const UINT64 u);
- void from_uint32(const UINT32 u);
+ void from_unsigned_long_long(const unsigned long long u);
+ void from_unsigned_long(const unsigned long u);
public:
@@ -123,9 +132,10 @@
virtual e_float& operator-=(const e_float& v);
virtual e_float& operator*=(const e_float& v);
virtual e_float& operator/=(const e_float& v);
-
- virtual e_float& mul_by_int(const INT32 n);
- virtual e_float& div_by_int(const INT32 n);
+ virtual e_float& add_unsigned_long_long(const unsigned long long n);
+ virtual e_float& sub_unsigned_long_long(const unsigned long long n);
+ virtual e_float& mul_unsigned_long_long(const unsigned long long n);
+ virtual e_float& div_unsigned_long_long(const unsigned long long n);
virtual e_float& calculate_inv (void);
virtual e_float& calculate_sqrt(void);
Modified: sandbox/e_float/libs/e_float/build/e_float.vcxproj
==============================================================================
--- sandbox/e_float/libs/e_float/build/e_float.vcxproj (original)
+++ sandbox/e_float/libs/e_float/build/e_float.vcxproj 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -779,6 +779,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release-gmp|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release-mpfr|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release-mpfr|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug-mpfr|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\e_float\gmp\e_float_gmp.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug-efx|Win32'">true</ExcludedFromBuild>
Modified: sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp (original)
+++ sandbox/e_float/libs/e_float/src/e_float/e_float_base.cpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -86,23 +86,26 @@
return width_of_e;
}
-e_float e_float_base::my_cbrt (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_rootn (const e_float&, const UINT32) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_exp (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_log (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_sin (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_cos (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_tan (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_asin (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_acos (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_atan (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_sinh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_cosh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_tanh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_asinh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_acosh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_atanh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_gamma (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_riemann_zeta (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_cyl_bessel_jn(const INT32, const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
-e_float e_float_base::my_cyl_bessel_yn(const INT32, const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_ldexp (const e_float&, int) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_frexp (const e_float&, int*) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_fmod (const e_float&, const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_cbrt (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_rootn (const e_float&, const UINT32) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_exp (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_log (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_sin (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_cos (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_tan (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_asin (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_acos (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_atan (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_sinh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_cosh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_tanh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_asinh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_acosh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_atanh (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_gamma (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_riemann_zeta (const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_cyl_bessel_jn(const INT32, const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
+e_float e_float_base::my_cyl_bessel_yn(const INT32, const e_float&) { return std::numeric_limits<e_float>::quiet_NaN(); }
Modified: sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp (original)
+++ sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -103,7 +103,8 @@
fpclass (ef_finite),
prec_elem(ef_elem_number)
{
- from_unsigned_long((!neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
+ (std::numeric_limits<char>::is_signed ? from_unsigned_long((!neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n))
+ : from_unsigned_long(static_cast<unsigned long>(n)));
}
efx::e_float::e_float(const signed char n) : data (),
@@ -126,11 +127,12 @@
efx::e_float::e_float(const wchar_t n) : data (),
exp (static_cast<INT64>(0)),
- neg (false),
+ neg (std::numeric_limits<wchar_t>::is_signed ? (n < static_cast<wchar_t>(0)) : false),
fpclass (ef_finite),
prec_elem(ef_elem_number)
{
- from_unsigned_long(static_cast<unsigned long>(n));
+ (std::numeric_limits<wchar_t>::is_signed ? from_unsigned_long((!neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n))
+ : from_unsigned_long(static_cast<unsigned long>(n)));
}
efx::e_float::e_float(const signed short n) : data (),
Modified: sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr.cpp (original)
+++ sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr.cpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -46,44 +46,59 @@
::mpfr_init(rop);
}
-mpfr::e_float::e_float(const INT32 n)
+mpfr::e_float::e_float(const char n)
{
- const bool b_neg = (n < static_cast<INT32>(0));
-
- from_uint32(b_neg ? static_cast<UINT32>(-n) : static_cast<UINT32>(n));
-
+ const bool b_neg = (std::numeric_limits<char>::is_signed && (n < static_cast<char>(0)));
+ from_unsigned_long((!b_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
if(b_neg) { ::mpfr_neg(rop, rop, GMP_RNDN); }
}
-mpfr::e_float::e_float(const INT64 n)
+mpfr::e_float::e_float(const signed char n)
{
- const bool b_neg = (n < static_cast<INT64>(0));
-
- from_uint64(b_neg ? static_cast<UINT64>(-n) : static_cast<UINT64>(n));
+ const bool b_neg = (n < static_cast<signed char>(0));
+ from_unsigned_long((!b_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
+ if(b_neg) { ::mpfr_neg(rop, rop, GMP_RNDN); }
+}
+mpfr::e_float::e_float(const signed short n)
+{
+ const bool b_neg = (n < static_cast<signed short>(0));
+ from_unsigned_long((!b_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
if(b_neg) { ::mpfr_neg(rop, rop, GMP_RNDN); }
}
-mpfr::e_float::e_float(const UINT32 u)
+mpfr::e_float::e_float(const signed int n)
{
- from_uint32(u);
+ const bool b_neg = (n < static_cast<signed int>(0));
+ from_unsigned_long((!b_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
+ if(b_neg) { ::mpfr_neg(rop, rop, GMP_RNDN); }
}
-mpfr::e_float::e_float(const UINT64 u)
+mpfr::e_float::e_float(const signed long n)
{
- from_uint64(u);
+ const bool b_neg = (n < static_cast<signed long>(0));
+ from_unsigned_long((!b_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
+ if(b_neg) { ::mpfr_neg(rop, rop, GMP_RNDN); }
}
-void mpfr::e_float::from_uint64(const UINT64 u)
+mpfr::e_float::e_float(const signed long long n)
{
- init();
- static_cast<void>(::mpfr_init_set_str(rop, Util::lexical_cast(u).c_str(), 10, GMP_RNDN));
+ const bool b_neg = (n < static_cast<signed long long>(0));
+ from_unsigned_long_long((!b_neg) ? static_cast<unsigned long long>(n) : static_cast<unsigned long long>(-n));
+ if(b_neg) { ::mpfr_neg(rop, rop, GMP_RNDN); }
}
-void mpfr::e_float::from_uint32(const UINT32 u)
+mpfr::e_float::e_float(const unsigned char n) { from_unsigned_long(static_cast<unsigned long>(n)); }
+mpfr::e_float::e_float(const wchar_t n) { from_unsigned_long(static_cast<unsigned long>(n)); }
+mpfr::e_float::e_float(const unsigned short n) { from_unsigned_long(static_cast<unsigned long>(n)); }
+mpfr::e_float::e_float(const unsigned int n) { from_unsigned_long(static_cast<unsigned long>(n)); }
+mpfr::e_float::e_float(const unsigned long n) { from_unsigned_long(static_cast<unsigned long>(n)); }
+mpfr::e_float::e_float(const unsigned long long n) { from_unsigned_long_long(static_cast<unsigned long long>(n)); }
+
+mpfr::e_float::e_float(const float f)
{
init();
- mpfr_init_set_ui(rop, static_cast<unsigned long>(u), GMP_RNDN);
+ mpfr_init_set_d(rop, static_cast<double>(f), GMP_RNDN);
}
mpfr::e_float::e_float(const double d)
@@ -92,6 +107,12 @@
mpfr_init_set_d(rop, d, GMP_RNDN);
}
+mpfr::e_float::e_float(const long double ld)
+{
+ init();
+ mpfr_init_set_ld(rop, ld, GMP_RNDN);
+}
+
mpfr::e_float::e_float(const e_float& f)
{
init();
@@ -138,6 +159,18 @@
::mpfr_clear(rop);
}
+void mpfr::e_float::from_unsigned_long_long(const unsigned long long u)
+{
+ init();
+ static_cast<void>(::mpfr_init_set_str(rop, Util::lexical_cast(u).c_str(), 10, GMP_RNDN));
+}
+
+void mpfr::e_float::from_unsigned_long(const unsigned long u)
+{
+ init();
+ mpfr_init_set_ui(rop, u, GMP_RNDN);
+}
+
const mpfr::e_float& mpfr::e_float::my_value_nan(void) const
{
static const e_float val;
@@ -198,33 +231,57 @@
return *this;
}
-mpfr::e_float& mpfr::e_float::mul_by_int(const INT32 n)
+mpfr::e_float& mpfr::e_float::add_unsigned_long_long(const unsigned long long n)
{
- const bool b_n_is_neg = (n < static_cast<INT32>(0));
-
- const unsigned long int nn = ((!b_n_is_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
+ if(n > static_cast<unsigned long long>(std::numeric_limits<unsigned long>::max()))
+ {
+ operator+=(e_float(n));
+ }
+ else
+ {
+ static_cast<void>(::mpfr_add_ui(rop, rop, static_cast<unsigned long>(n), GMP_RNDN));
+ }
- static_cast<void>(::mpfr_mul_ui(rop, rop, nn, GMP_RNDN));
+ return *this;
+}
- if(b_n_is_neg)
+mpfr::e_float& mpfr::e_float::sub_unsigned_long_long(const unsigned long long n)
+{
+ if(n > static_cast<unsigned long long>(std::numeric_limits<unsigned long>::max()))
+ {
+ operator-=(e_float(n));
+ }
+ else
{
- ::mpfr_neg(rop, rop, GMP_RNDN);
+ static_cast<void>(::mpfr_sub_ui(rop, rop, static_cast<unsigned long>(n), GMP_RNDN));
}
return *this;
}
-mpfr::e_float& mpfr::e_float::div_by_int(const INT32 n)
+mpfr::e_float& mpfr::e_float::mul_unsigned_long_long(const unsigned long long n)
{
- const bool b_neg = (n < static_cast<INT32>(0));
-
- const unsigned long int nn = ((!b_neg) ? static_cast<unsigned long>(n) : static_cast<unsigned long>(-n));
+ if(n > static_cast<unsigned long long>(std::numeric_limits<unsigned long>::max()))
+ {
+ operator*=(e_float(n));
+ }
+ else
+ {
+ static_cast<void>(::mpfr_mul_ui(rop, rop, static_cast<unsigned long>(n), GMP_RNDN));
+ }
- static_cast<void>(::mpfr_div_ui(rop, rop, nn, GMP_RNDN));
+ return *this;
+}
- if(b_neg)
+mpfr::e_float& mpfr::e_float::div_unsigned_long_long(const unsigned long long n)
+{
+ if(n > static_cast<unsigned long long>(std::numeric_limits<unsigned long>::max()))
+ {
+ operator/=(e_float(n));
+ }
+ else
{
- ::mpfr_neg(rop, rop, GMP_RNDN);
+ static_cast<void>(::mpfr_div_ui(rop, rop, static_cast<unsigned long>(n), GMP_RNDN));
}
return *this;
Modified: sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr_protos.h
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr_protos.h (original)
+++ sandbox/e_float/libs/e_float/src/e_float/mpfr/e_float_mpfr_protos.h 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -24,10 +24,12 @@
#define mpfr_set(x, y, rnd) mpfr_set4((x), (y), (rnd), MPFR_SIGN(y))
int mpfr_set_ui (mpfr_ptr, unsigned long, mp_rnd_t);
int mpfr_set_d (mpfr_ptr, double, mp_rnd_t);
+ int mpfr_set_ld (mpfr_ptr, long double, mp_rnd_t);
- #define mpfr_init_set(x, y, rnd) ( mpfr_init(x), static_cast<void>(mpfr_set ((x), (y), (rnd))))
- #define mpfr_init_set_ui(x, i, rnd) ( mpfr_init(x), static_cast<void>(mpfr_set_ui((x), (i), (rnd))))
- #define mpfr_init_set_d(x, d, rnd) ( mpfr_init(x), mpfr_set_d((x), (d), (rnd)))
+ #define mpfr_init_set(x, y, rnd) ( mpfr_init(x), static_cast<void>(mpfr_set ((x), (y), (rnd))))
+ #define mpfr_init_set_ui(x, i, rnd) ( mpfr_init(x), static_cast<void>(mpfr_set_ui((x), (i), (rnd))))
+ #define mpfr_init_set_d(x, d, rnd) ( mpfr_init(x), static_cast<void>(mpfr_set_d((x), (d), (rnd))))
+ #define mpfr_init_set_ld(x, ld, rnd) ( mpfr_init(x), static_cast<void>(mpfr_set_ld((x), (ld), (rnd))))
int mpfr_init_set_str(mpfr_ptr, const char*, int, mp_rnd_t);
int mpfr_add(mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mp_rnd_t);
Modified: sandbox/e_float/libs/e_float/src/functions/elementary/elementary_trans.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/functions/elementary/elementary_trans.cpp (original)
+++ sandbox/e_float/libs/e_float/src/functions/elementary/elementary_trans.cpp 2011-08-05 08:53:12 EDT (Fri, 05 Aug 2011)
@@ -768,19 +768,8 @@
const e_float e_px = ef::exp(x);
const e_float e_mx = ef::one() / e_px;
- if(p_sinh)
- {
- *p_sinh = e_px;
- *p_sinh -= e_mx;
- p_sinh->div_unsigned_long_long(2u);
- }
-
- if(p_cosh)
- {
- *p_cosh = e_px;
- *p_cosh += e_mx;
- p_cosh->div_unsigned_long_long(2u);
- }
+ if(p_sinh != static_cast<e_float* const>(0u)) { *p_sinh = (e_px - e_mx) / static_cast<INT32>(2); }
+ if(p_cosh != static_cast<e_float* const>(0u)) { *p_cosh = (e_px + e_mx) / static_cast<INT32>(2); }
}
e_float ef::tanh(const e_float& x)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk