Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37977

Re: Unexpected Boxing Error at Runtime

Newsgroups comp.lang.java.programmer
Date 2018-01-22 14:33 -0800
References (8 earlier) <2og75ddcriocfvaejf49n59r23ur2j5m9u@4ax.com> <p30hge$v1b$1@dont-email.me> <ig885d5jurdj1amhr07sjc4ghcuct8htpb@4ax.com> <p3jkq7$btf$1@dont-email.me> <28ad0dde-7a53-406d-a424-10b45cc9364a@googlegroups.com>
Message-ID <cdca7ca3-63e9-4088-8f2b-da8fe5da2c55@googlegroups.com> (permalink)
Subject Re: Unexpected Boxing Error at Runtime
From bursejan@gmail.com

Show all headers | View raw


Not sure whether MATLAB is the right example,
but going to Wolfram Alpha gives me easily:

floor(10^36/81)
https://www.wolframalpha.com/input/?i=floor%2810^36%2F81%29

This doesn't fit into a Java int.

Am Montag, 22. Januar 2018 23:26:56 UTC+1 schrieb burs...@gmail.com:
> If you go to FaceBook and Google+ Java programmers
> groups, you see a lot of newbees expecting that
> an overflow check is the default.
> 
> But somehow, when you are from an older generation,
> and when you read the Java spec, and see that primitive
> types such as int and long are fixed in type sizes,
> 
> etc.. etc.. then you remember what a CPU arithmetic
> means, and that this is usually, where n depends
> on the type sizes:
>  
>   a +_CPU b = (a + b) mod 2^n
> 
>   a -_CPU b = (a - b) mod 2^n
> 
>   a *_CPU b = (a * b) mod 2^n
> 
>   a /_CPU b = (a / b) mod 2^n
> 
>   Etc..
> 
> I really admired Java always that they had fixed the
> type sizes. In other languages, such as C, it might
> easily happen that n varies from platform to platform,
> 
> and you need to define your own types, if you want
> them to be constant from platform to platform. But well
> the overall expectation seems really to be
> 
> that languages are more safe or parallel recursion
> theory, where we assume unbounded integers. Maybe this
> has also to do, that on a higher level, some
> 
> applications such as MATLAB etc.. etc.. deliver
> the illusion of the recursion theoretic model. Which
> might mislead programms that touch Java for the first time.
> 
> Am Dienstag, 16. Januar 2018 02:34:13 UTC+1 schrieb Daniele Futtorovic:
> > On 2018-01-09 03:03, Gene Wirchenko wrote:
> > > On Mon, 8 Jan 2018 20:40:59 +0100, Daniele Futtorovic
> > > <da.futt.news@laposte.net> wrote:
> > >      Despite all one's thought on the matter, errors can still happen.
> > > Read up about the Ariane 5 launch that went wrong.  It was due to code
> > > reuse from the Ariane 4.  An assumption that was true on the Ariane 4
> > > was not true about the Ariane 5, and Bad Stuff happened.
> > > 
> > >> You are imputing that an overflow is a garbage result per se. Therefore,
> > >> you argue, letting an overflow happen, regardless of whether one thinks
> > >> about it or not, is an error. Well, yeah. But that's a strawman.
> > > 
> > >      It almost always is.  Since it is the exceptional case, let it be
> > > handled exceptionally.
> > 
> > I know about the Ariane 5 thing. And yes, I have to agree that wanting
> > an overflow is the exceptional case. And that exceptional handling for
> > it is therefore justified. I prefer it without, at a gut level; but
> > having thought about it some more, I cannot argue against it intellectually.
> > 
> > -- 
> > DF.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Unexpected Boxing Error at Runtime j4n bur53 <janburse@fastmail.fm> - 2018-01-04 15:16 +0100
  Re: Unexpected Boxing Error at Runtime Eric Douglas <e.d.programmer@gmail.com> - 2018-01-04 07:04 -0800
  Re: Unexpected Boxing Error at Runtime Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-01-04 10:13 -0500
  Re: Unexpected Boxing Error at Runtime Eric Douglas <e.d.programmer@gmail.com> - 2018-01-04 08:01 -0800
    Re: Unexpected Boxing Error at Runtime Marcel Mueller <news.5.maazl@spamgourmet.org> - 2018-01-04 18:33 +0100
      Re: Unexpected Boxing Error at Runtime Kiwi User <martin@mydomain.invalid> - 2018-01-04 19:29 +0000
    Re: Unexpected Boxing Error at Runtime Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-01-04 15:09 -0500
      Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-04 21:43 +0100
        Re: Unexpected Boxing Error at Runtime Arne Vajhøj <arne@vajhoej.dk> - 2018-01-04 15:53 -0500
          Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-05 16:06 +0100
            Re: Unexpected Boxing Error at Runtime Gene Wirchenko <genew@telus.net> - 2018-01-05 09:51 -0800
              Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-05 20:59 +0100
                Re: Unexpected Boxing Error at Runtime Eric Douglas <e.d.programmer@gmail.com> - 2018-01-05 12:15 -0800
                Re: Unexpected Boxing Error at Runtime Kiwi User <martin@mydomain.invalid> - 2018-01-05 21:52 +0000
                Re: Unexpected Boxing Error at Runtime Gene Wirchenko <genew@telus.net> - 2018-01-08 11:13 -0800
                Re: Unexpected Boxing Error at Runtime Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-01-05 16:27 -0500
                Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-06 00:06 +0100
                Re: Unexpected Boxing Error at Runtime Kiwi User <martin@mydomain.invalid> - 2018-01-05 23:57 +0000
                Re: Unexpected Boxing Error at Runtime Arne Vajhøj <arne@vajhoej.dk> - 2018-01-07 20:06 -0500
                Re: Unexpected Boxing Error at Runtime bursejan@gmail.com - 2018-01-08 04:10 -0800
                Re: Unexpected Boxing Error at Runtime bursejan@gmail.com - 2018-01-08 04:31 -0800
                Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-08 16:25 +0100
                Re: Unexpected Boxing Error at Runtime Arne Vajhøj <arne@vajhoej.dk> - 2018-01-08 20:05 -0500
                Re: Unexpected Boxing Error at Runtime bursejan@gmail.com - 2018-01-08 17:55 -0800
                Re: Unexpected Boxing Error at Runtime Gene Wirchenko <genew@telus.net> - 2018-01-08 11:19 -0800
                Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-08 20:40 +0100
                Re: Unexpected Boxing Error at Runtime Gene Wirchenko <genew@telus.net> - 2018-01-08 18:03 -0800
                Re: Unexpected Boxing Error at Runtime Daniele Futtorovic <da.futt.news@laposte.net> - 2018-01-16 02:33 +0100
                Re: Unexpected Boxing Error at Runtime bursejan@gmail.com - 2018-01-22 14:26 -0800
                Re: Unexpected Boxing Error at Runtime bursejan@gmail.com - 2018-01-22 14:33 -0800
        Re: Unexpected Boxing Error at Runtime Arne Vajhøj <arne@vajhoej.dk> - 2018-01-04 19:16 -0500
          Re: Unexpected Boxing Error at Runtime Kiwi User <martin@mydomain.invalid> - 2018-01-05 12:17 +0000
  Re: Unexpected Boxing Error at Runtime j4n bur53 <janburse@fastmail.fm> - 2018-01-05 00:13 +0100
    Re: Unexpected Boxing Error at Runtime Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-01-05 11:05 -0500
      Re: Unexpected Boxing Error at Runtime bursejan@gmail.com - 2018-01-06 06:18 -0800

csiph-web