🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7464

Re: Newbie Truncate question

#7464
From: Rich Wilkman
Date: Wed, 20 Jun 2001 16:54
19 lines
1537 bytes
Mark:

Or you could check sign, Math.abs it, floor it and then reapply the sign
on the way out.  This cat has been skinned six ways from Sunday!

-Rich

Mark Griffiths wrote:
> 
> I wrote:
> > int anInteger = Math.floor(aDouble);
> >
> > (floor() is a static method in the class java.lang.Math)
> 
> 1. I forgot the cast.  It should be:  int anInteger =
> (int)Math.floor(aDouble)
> 
> 2. Also, watch out for negative values.  Math.floor(-3.5) will return 4.0.
> You may find Math.ceil() more appropriate for negative values.
Technical Details
Message-ID: <3B30D556.E9972E8C@formlessvoid.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b2f52a0_1@dnews> <3b2fb6e4_1@dnews> <3b306dae_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,568d12e56ba0c6bd
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-20 10:22:37 PST
Message-ID: <3B30D556.E9972E8C@formlessvoid.com>
Date: Wed, 20 Jun 2001 09:54:46 -0700
From: Rich Wilkman <richw@formlessvoid.com>
X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Newbie Truncate question
References: <3b2f52a0_1@dnews> <3b2fb6e4_1@dnews> <3b306dae_2@dnews>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.236.69.60
X-Trace: dnews 993056084 208.236.69.60 (20 Jun 2001 09:54:44 -0700)
Lines: 19
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews