Re: [GENERAL] Output float number with hex format

2010-01-29 Thread
on. I mean we should use sprintf(str, "%.15g", val) and strtod. I have tested about 1 random float values, it works fine. Interestingly, if I use "%.16g", "%.17g"...etc, precision lost will occur. -- ShenLei 2010/1/29 Vincenzo Romano > 2010/1/29 沈雷 : > >

[GENERAL] Output float number with hex format

2010-01-28 Thread
Hi! In C Language, there is a way to format float numbers into a hex string by using "%a" in printf. eg: the value: 1.2345 can be expressed as '0x1.3c083126e978dp+0' which is the hex representation of a float number. I have tried this in Postgres: SELECT '0x1.3c083126e978dp+0'::float; float8 ---