🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #1004

Redondeos

#1004
From: Pedro
Date: Sun, 17 Sep 2006 01:09
25 lines
1240 bytes
Hola.

para redondear como la funci�n round de SQL

Select round(23.5740, 2) as numero from actualizacion

que es = 23.57

select round(23.5790, 2) as numero from actualizacion

que es = 23.58


en java hago esto

BigDecimal big = new BigDecimal(23.505999D);

System.out.println(big.round(new MathContext(4,RoundingMode.HALF_UP)));


Hay alguna otra forma.



Gracias y Saludos
Technical Details
Message-ID: <eei773$lgv269@cesio.mundo-r.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!cesio.mundo-r.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1116f3,49bbb31c3344c14a,start
X-Google-Attributes: gid1116f3,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!cesio.mundo-r.com!not-for-mail
From: Pedro <Pedro@ddd.com>
Newsgroups: es.comp.lenguajes.java
Subject: Redondeos
Date: Sun, 17 Sep 2006 03:09:55 +0200
Organization: R Cable y Telecomunicaciones
Lines: 25
Message-ID: <eei773$lgv269@cesio.mundo-r.com>
Reply-To: Pedro@ddd.com
NNTP-Posting-Host: cm10158.red83-165.mundo-r.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.7.12) Gecko/20050915
X-Accept-Language: es, es-es, en-us, en