Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39601
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Compare generics (that are numbers) |
| Date | Thu, 30 Jul 2020 09:03:14 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 24 |
| Message-ID | <rfugel$qk$1@dont-email.me> (permalink) |
| References | <87k0ym73id.fsf@munus.decebal.nl> <rfscpe$doa$1@dont-email.me> <87ft9a6u35.fsf@munus.decebal.nl> <rfsgek$jm4$1@gioia.aioe.org> <87bljy6qu3.fsf@munus.decebal.nl> <rft7um$17k2$1@gioia.aioe.org> <87zh7h5ouj.fsf@munus.decebal.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Thu, 30 Jul 2020 13:03:17 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="3a3532b4fb7317e8571e5c02d58681f5"; logging-data="852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19c0wgv/RwholZsqsgfbJmm" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
| Cancel-Lock | sha1:kg+TzfqY42fexGYQlR4HpI8NV+E= |
| In-Reply-To | <87zh7h5ouj.fsf@munus.decebal.nl> |
| Content-Language | en-US |
| Xref | csiph.com comp.lang.java.programmer:39601 |
Show key headers only | View raw
On 7/30/2020 5:33 AM, Cecil Westerhof wrote:
> Arne Vajhøj <arne@vajhoej.dk> writes:
>
>> But if this is performance critical then why not just drop the
>> generic stuff and write specific code for the types?
>
> Because I want to show the differences between using
> Float/float/Integer/int and different implementations thereof.
Is this a "practical problem," or a "teaching exercise?" If the
former, I'd be interested to know how it arises -- needing to compare
one arbitrary Number to another (BigDecimal vs. AtomicLong?) seems not
out of the question, but surely unusual.
If it's a teaching tool, you might want to reconsider the vehicle.
As has been pointed out, some combinations (DoubleAdder vs. BigInteger,
others) raise a lot of thorny and niggling special cases that might
tend to obscure whatever point you're trying to put across. Maybe if
folks had a better idea of the goals they'd suggest better approaches.
--
esosman@comcast-dot-net.invalid
If he's so rich, why ain't he smart?
One hundred seventy-four days to go.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Compare generics (that are numbers) Cecil Westerhof <Cecil@decebal.nl> - 2020-07-29 17:19 +0200
Re: Compare generics (that are numbers) Arne Vajhøj <arne@vajhoej.dk> - 2020-07-29 13:21 -0400
Re: Compare generics (that are numbers) Arne Vajhøj <arne@vajhoej.dk> - 2020-07-29 13:27 -0400
Re: Compare generics (that are numbers) Eric Sosman <esosman@comcast-dot-net.invalid> - 2020-07-29 13:48 -0400
Re: Compare generics (that are numbers) Cecil Westerhof <Cecil@decebal.nl> - 2020-07-29 20:42 +0200
Re: Compare generics (that are numbers) Arne Vajhøj <arne@vajhoej.dk> - 2020-07-29 14:50 -0400
Re: Compare generics (that are numbers) Cecil Westerhof <Cecil@decebal.nl> - 2020-07-29 21:53 +0200
Re: Compare generics (that are numbers) Arne Vajhøj <arne@vajhoej.dk> - 2020-07-29 21:32 -0400
Re: Compare generics (that are numbers) Cecil Westerhof <Cecil@decebal.nl> - 2020-07-30 11:33 +0200
Re: Compare generics (that are numbers) Eric Sosman <esosman@comcast-dot-net.invalid> - 2020-07-30 09:03 -0400
Re: Compare generics (that are numbers) Cecil Westerhof <Cecil@decebal.nl> - 2020-07-30 17:00 +0200
Re: Compare generics (that are numbers) Arne Vajhøj <arne@vajhoej.dk> - 2020-07-30 09:21 -0400
Re: Compare generics (that are numbers) Silvio <silvio@internet.com> - 2020-07-30 08:51 +0200
Re: Compare generics (that are numbers) Cecil Westerhof <Cecil@decebal.nl> - 2020-07-30 11:36 +0200
Re: Compare generics (that are numbers) Marcel Mueller <news.5.maazl@spamgourmet.org> - 2020-07-29 20:59 +0200
csiph-web