Обсуждение: Exponential display of values

Поиск
Список
Период
Сортировка

Exponential display of values

От
HK
Дата:
Hi all,
  I have a numeric field in the table which denotes the bit error rate.
So i want to display the values in a normalised form i.e   0.xy e-z
  The problem is if the value is something like 0 or 0.01, it is displayed as
the same. How do i display all values in the same format, so that visual
comparison can be done easily in the front end i am providing.
  I have a gut feeling it can be done, but am unable to figure out how.
Plz help me.
TIA.

Regards,
Hari.


Re: Exponential display of values

От
Josh Berkus
Дата:
Hari,

>   I have a numeric field in the table which denotes the bit error rate.
> So i want to display the values in a normalised form i.e   0.xy e-z
>   The problem is if the value is something like 0 or 0.01, it is displayed
> as the same. How do i display all values in the same format, so that visual
> comparison can be done easily in the front end i am providing.
>   I have a gut feeling it can be done, but am unable to figure out how.
> Plz help me.

Please see the documentation on "to_char()"
Online Docs --> User Documentation --> Functions and Operators --> Formatting
Functions.

--
Josh Berkus
Aglio Database Solutions
San Francisco

Re: Exponential display of values

От
Joe Conway
Дата:
Josh Berkus wrote:
> Please see the documentation on "to_char()"
> Online Docs --> User Documentation --> Functions and Operators --> Formatting
> Functions.
>

Yeah, except the manual says this (even in 7.4):
EEEE    scientific notation (not implemented yet)

You probably need to write a custom plperl (or pltcl, plpython, etc)
function.

Joe