This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc -fsingle-precision-constant


Hello,

I was trying to compile:

template <class Type>
inline Type clamp(const Type a,
                  const Type b,
                  const Type c) { return a > b ? (a < c ? a : c) : b ; }

int main()
{
  double a = 5.0;
  double b = clamp(a, -1., 1. );

  return 0;
}

Using

gcc -fsingle-precision-constant foo.cxx

And gcc returns:

foo.cxx: In function `int main()':
foo.cxx:9: error: no matching function for call to `clamp(double&, float, float
)'



I believe that by default all floating point number should be consider double. Am I correct ?


Thanks
Mathieu



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]