🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Newbie Truncate question

#7351
From: John McGrath TeamB
Date: Sun, 24 Jun 2001 08:51
32 lines
2020 bytes
On Sat, 23 Jun 2001 12:15:36 -0400, "CLG" <lamont_gilbert @ 
rigidsoftware.com> wrote:

> Since when does casting round??

The Java Language Specification uses the terminology from the IEEE 754 
floating point spec.  Java uses "round toward zero" as opposed to 
"round to nearest".  What it calls "round toward zero" is often 
referred to as truncation.

From JLS section 5.1.3:

    ... the floating-point value is rounded to an integer value V,
    rounding toward zero using IEEE 754 round-toward-zero mode
   (�4.2.3).

And section 4.2.3 says:

    The language uses round toward zero when converting a floating
    value to an integer (�5.1.3), which acts, in this case, as though
    the number were truncated, discarding the mantissa bits. Rounding
    toward zero chooses at its result the format's value closest to
    and no greater in magnitude than the infinitely precise result.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.159f70098c2c2fe498a2d7@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!news.stgl.sel.alcatel.de!news.stgl.sel.alcatel.de!dnews
References: <3b2f52a0_1@dnews> <3b327232$1_2@dnews> <3b32fc72$1_1@dnews> <3b34c1a3$1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,568d12e56ba0c6bd
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-24 02:06:22 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Newbie Truncate question
Date: Sun, 24 Jun 2001 04:51:01 -0400
Message-ID: <MPG.159f70098c2c2fe498a2d7@forums.borland.com>
References: <3b2f52a0_1@dnews> <3b327232$1_2@dnews> <3b32fc72$1_1@dnews> <3b34c1a3$1_2@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 993372661 209.92.40.60 (24 Jun 2001 01:51:01 -0700)
Lines: 32
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!news1.dtag.de!news.stgl.sel.alcatel.de!news.stgl.sel.alcatel.de!dnews