Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: como dividir?


  • From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
  • To: Henry <hensa22(at)yahoo(dot)es>
  • Cc: Rodriguez Fernando <rodriguez(at)ort(dot)edu(dot)uy>, ricardo yanguma <ricardo(dot)yanguma(at)gmail(dot)com>, postgresayuda <pgsql-es-ayuda(at)postgresql(dot)org>
  • Subject: Re: como dividir?
  • Date: Thu, 31 Jan 2008 08:49:23 -0300
  • Message-id: <20080131114922(dot)GA5145(at)alvh(dot)no-ip(dot)org>

Algo que no se ha comentado es la precisión del resultado.  Considera

alvherre=# select 1::float/7;
     ?column?      
-------------------
 0.142857142857143
(1 row)

alvherre=# select 1::float8/7;
     ?column?      
-------------------
 0.142857142857143
(1 row)

alvherre=# select 1::numeric/7;
        ?column?        
------------------------
 0.14285714285714285714
(1 row)

alvherre=# select 1::numeric(44,42)/7;
                   ?column?                   
----------------------------------------------
 0.142857142857142857142857142857142857142857
(1 row)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group