Re: Division by zero error in to_char(num, '9.9EEEE')

2021-08-04 Thread Dean Rasheed
On Fri, 30 Jul 2021 at 08:26, Dean Rasheed wrote: > > SELECT to_char(1.2e-1002, '9.9'); -- fails > ERROR: division by zero > > I think the simplest > solution is to just introduce a new local function, as in the attached > patch. This directly constructs 10^n, for integer n, which is pretty >

Division by zero error in to_char(num, '9.9EEEE')

2021-07-30 Thread Dean Rasheed
While testing the numeric_power() patch in [1], I found this problem trying to use to_char() to format very small numbers: SELECT to_char(1.2e-1001, '9.9'); -- OK to_char 1.2e-1001 SELECT to_char(1.2e-1002, '9.9'); -- fails ERROR: division by zero It turns out that the