* VFP 9.1720 * When CAST N to C allocate for the integer part a minimum of 10 characters * this choice is for a decimal point alignment, but it have a lot of side effects * Expected rules, in ORDER of priority : * - when possible, no loss of data, OTHERWISE PUT NULL ! * - for V(N) ALLTRIMmed ( now VFP9.1720 do a C(N) casting and after apply a RTRIM() * - for C(N) right alignment use useful for output alignment, * but this not respect the CAST(CAST(nExp AS C(N)) AS V(N)) == CAST(nExp AS V(N)) invariance * For the decimal point alignment, the best solution is allow nPrecision usability for C() and V() casting * - example : CAST(-1.56 AS C(9,6) => |-1.56 | * Have SET FIXED ON/OFF to overridde the nExp decimals ? This is a possible choice for a global casting. * to recapitulate : C(n,m) overridde SET FIXED ON + SET DECIMALS and this last overridde nExp. * run this and read output comments ( and read the others issue and bug on internal comment) *------------------------------------------- * set natural casting ( VFP9.1720 is not subject to SET FIXED control ) CLEAR _screen.FontSize = 8 SET DECIMALS TO 18 SET FIXED OFF ? "************* FIXED : OFF ***********" && , SET("Fixed") this is a VFP issue: not exists a command for get the SET FIXED status lnNumber = -1.8 ? "value is ", m.lnNumber ? "CHAR 11" ,"|"+CAST(m.lnNumber as c(11))+"|" AT 10," => Expected |"+PADL(m.lnNumber,11)+"|" AT 50 ? "VARCHAR 11" ,"|"+CAST(m.lnNumber as v(11))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,11))+"|" AT 50 ?'-------------------------' lnNumber = -1.12345678 ? "value is ", m.lnNumber ? "CHAR 11" ,"|"+CAST(m.lnNumber as c(11))+"|" AT 10," => Expected |"+PADL(m.lnNumber,11)+"|" AT 50 ? "VARCHAR 11" ,"|"+CAST(m.lnNumber as v(11))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,11))+"|" AT 50 ?'-------------------------' lnNumber = -1.1234567891 ? "value is ", m.lnNumber ? "CHAR 20" ,"|"+CAST(m.lnNumber as c(20))+"|" AT 10," => Expected |"+PADL(m.lnNumber,20)+"|" AT 50 ? "VARCHAR 20" ,"|"+CAST(m.lnNumber as v(20))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,20))+"|" AT 50 ?'-------------------------' lnNumber = - 1234567890.1 ? "value is ", m.lnNumber , "sorry, it is :",m.lnNumber*1 && HERE YOU CAN SEE ANOTHER VFP BUG ? "CHAR 20" ,"|"+CAST(m.lnNumber as c(20))+"|" AT 10," => Expected |"+PADL(m.lnNumber,20)+"|" AT 50 ? "VARCHAR 20" ,"|"+CAST(m.lnNumber as v(20))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,20))+"|" AT 50 ?'-------------------------' lnNumber = - 1234567890 ? "value is ", m.lnNumber ? "CHAR 30" ,"|"+CAST(m.lnNumber as c(30))+"|" AT 10," => Expected |"+PADL(m.lnNumber,30)+"|" AT 50 ? "VARCHAR 30" ,"|"+CAST(m.lnNumber as v(30))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,30))+"|" AT 50 ?'-------------------------' lnNumber = INT(- 2^53) ? "value is ", m.lnNumber ? "CHAR 20" ,"|"+CAST(m.lnNumber as c(20))+"|" AT 10," => Expected |"+PADL(m.lnNumber,20)+"|" AT 50 ? "VARCHAR 20" ,"|"+CAST(m.lnNumber as v(20))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,20))+"|" AT 50 ?'-------------------------' lnNumber = -1.1234567891 ? "value is ", m.lnNumber ? "CHAR 11" ,"|"+CAST(m.lnNumber as c(11))+"|" AT 10," => Expected | .NULL. |" AT 50 ? "VARCHAR 11" ,"|"+CAST(m.lnNumber as v(11))+"|" AT 10," => Expected | .NULL. |" AT 50 ?'-------------------------' * next expected are a my subjective choice SET FIXED ON ? "*************** FIXED : ON ************" SET DECIMALS TO 6 ? "DECIMALS :",SET("Decimals") lnNumber = -1.8 ? "value is ", PADL(m.lnNumber,20) ? "CHAR 11" ,"|"+CAST(m.lnNumber as c(11))+"|" AT 10," => Expected |"+PADL("-1.8 ",11)+"|" AT 50 ? "VARCHAR 11" ,"|"+CAST(m.lnNumber as v(11))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,11))+"|" AT 50 ?'-------------------------' lnNumber = -1.12345678 ? "value is ", PADL(m.lnNumber,20) ? "CHAR 11" ,"|"+CAST(m.lnNumber as c(11))+"|" AT 10," => Expected a .NULL." AT 50 ? "VARCHAR 11" ,"|"+CAST(m.lnNumber as v(11))+"|" AT 10," => Expected a .NULL." AT 50 ?'-------------------------' lnNumber = -1.1234567891 ? "value is ", PADL(m.lnNumber,20) ? "CHAR 20" ,"|"+CAST(m.lnNumber as c(20))+"|" AT 10," => Expected a .NULL." AT 50 ? "VARCHAR 20" ,"|"+CAST(m.lnNumber as v(20))+"|" AT 10," => Expected a .NULL." AT 50 ?'-------------------------' lnNumber = - 1234567890.1 ? "value is ", PADL(m.lnNumber,20) ? "CHAR 20" ,"|"+CAST(m.lnNumber as c(20))+"|" AT 10," => Expected |"+PADL("-1234567890.100000",20)+"|" AT 50 ? "VARCHAR 20" ,"|"+CAST(m.lnNumber as v(20))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,20))+"|" AT 50 ?'-------------------------' lnNumber = - 1234567890 ? "value is ", PADL(m.lnNumber,20) ? "CHAR 30" ,"|"+CAST(m.lnNumber as c(30))+"|" AT 10," => Expected |"+PADL("-1234567890 ",30)+"|" AT 50 ? "VARCHAR 30" ,"|"+CAST(m.lnNumber as v(30))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,30))+"|" AT 50 ?'-------------------------' lnNumber = INT(- 2^53) ? "value is ", PADL(m.lnNumber,20) ? "CHAR 20" ,"|"+CAST(m.lnNumber as c(20))+"|" AT 10," => Expected |"+PADL("-9007199254740992",20)+"|" AT 50 ? "VARCHAR 20" ,"|"+CAST(m.lnNumber as v(20))+"|" AT 10," => Expected |"+LTRIM(PADL(m.lnNumber,20))+"|" AT 50I have inserted what I waited, any comment to them (with of the motivations) is welcomed.