On Wed, Apr 1, 2015 at 11:48:37AM -0400, Bruce Momjian wrote:
> This should return something like 15555600000000.000... (per Oracle
> output at the URL above, float4 has 6 significant digits on my compiler)
> but I can't seem to figure how to get printf() to round non-fractional
> parts. I am afraid the only solution is to use printf's %e format and
> place the decimal point myself.
Hearing nothing, I went with the %e approach; patch attached. The new
output looks right:
test=> SELECT to_char(float4 '15555555555555.912345678912345678900000000000000000000000',
repeat('9', 50) || '.' || repeat('9', 50));
to_char
--------------------------------------------------------------------------------------------------------
15555600000000.00000000000000000000000000000000000000000000000000
(1 row)
> The fact I still don't have a complete solution suggests this is 9.6
> material but I still want to work on it so it is ready.
I will keep this patch for 9.6 unless I hear otherwise.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +