CINT bug handling "operator float()"

From: Philip Rodrigues <p.rodrigues1_at_physics.ox.ac.uk>
Date: Mon, 10 Aug 2009 18:14:59 +0100


Hi,

Hi roottalk,

The program below prints the correct output "5 5" when run compiled, but I get "5 1.69975e+08" when I run it interpreted. It seems that CINT doesn't apply the correct C type conversion rules to the result of the "operator float()" function. The bug also applies if the class is compiled, but the line "double d = ft;" is run in interpreted mode.

We have code wrapping basic types like this in order to handle value-error pairs and treat them correctly in arithmetic operations.

Regards,
Philip

#include <iostream>
using namespace std;

class FloatT
{

public:

   FloatT(float v) : fVal(v){}
   operator float(){return fVal;}
private:

   float fVal;
};

void cint_float()
{

   FloatT ft(5);
   float f = ft;
   double d = ft;
   cout << f << " " << d << endl;
} Received on Mon Aug 10 2009 - 19:15:02 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 10 2009 - 23:50:01 CEST