edwig / BCD

Binary Coded Decimal. Research project for use with SQL_NUMERIC_STRUCT datatype
MIT License
12 stars 1 forks source link

std::string _afp_ftoa function returns wrong string #8

Closed sisirajaya closed 4 years ago

sisirajaya commented 4 years ago

when afp object casted to double you get wrong value;

afp af = 30.0; double daf = (double)af;

now daf is 3.0

Fix:

in afp.cpp lines 2159 should be: // erase "." only if it is there if (s[2]=='.') s.erase(2,1);

edwig commented 4 years ago

Corrected and added UnitTestAFP to test it. See T001_double.