🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Newbie Truncate question

#7451
From: Mark Griffiths
Date: Wed, 20 Jun 2001 09:32
10 lines
1264 bytes
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: <3b306dae_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.skycache.com!Cidera!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>

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 02:39:43 PST
From: "Mark Griffiths" <DONT.SPAM.mark@chive.com>
Newsgroups: borland.public.jbuilder.java.language
References: <3b2f52a0_1@dnews> <3b2fb6e4_1@dnews>
Subject: Re: Newbie Truncate question
Date: Wed, 20 Jun 2001 10:32:49 +0100
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 213.122.143.248
Message-ID: <3b306dae_2@dnews>
X-Trace: dnews 993029550 213.122.143.248 (20 Jun 2001 02:32:30 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.skycache.com!Cidera!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews