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


Groups > comp.lang.java.programmer > #27756 > unrolled thread

how to use unsinged long in java

Started byNavneet Mathpal <navneetmathpal93@gmail.com>
First post2014-03-13 23:53 -0700
Last post2014-03-14 19:53 +0100
Articles 11 — 9 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  how to use unsinged long in java Navneet Mathpal <navneetmathpal93@gmail.com> - 2014-03-13 23:53 -0700
    Re: how to use unsinged long in java Lew <lewbloch@gmail.com> - 2014-03-14 00:31 -0700
      Re: how to use unsinged long in java Joerg Meier <joergmmeier@arcor.de> - 2014-03-14 11:40 +0100
        Re: how to use unsinged long in java markspace <markspace@nospam.nospam> - 2014-03-14 09:40 -0700
        Re: how to use unsinged long in java Arivald <arivald_@AT_interia_DOT_.pl> - 2014-03-17 10:19 +0100
          Re: how to use unsinged long in java Lew <lewbloch@gmail.com> - 2014-03-22 15:30 -0700
            Re: how to use unsinged long in java Roedy Green <see_website@mindprod.com.invalid> - 2014-04-09 18:06 -0700
    Re: how to use unsinged long in java v_borchert@despammed.com (Volker Borchert) - 2014-03-14 10:24 +0000
    Re: how to use unsinged long in java Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-03-14 08:46 -0400
    Re: how to use unsinged long in java Roedy Green <see_website@mindprod.com.invalid> - 2014-03-14 08:42 -0700
    Re: how to use unsinged long in java Marcel Müller <news.5.maazl@spamgourmet.org> - 2014-03-14 19:53 +0100

#27756 — how to use unsinged long in java

FromNavneet Mathpal <navneetmathpal93@gmail.com>
Date2014-03-13 23:53 -0700
Subjecthow to use unsinged long in java
Message-ID<69b21f21-4322-4915-b425-86dace6e5bd6@googlegroups.com>
hi 
I wnat to store 20141231246023 but long is out of range in it.
how to save value in this range.
is there any unSigned long available??

I was trying unSigned long but not working ..

[toc] | [next] | [standalone]


#27757

FromLew <lewbloch@gmail.com>
Date2014-03-14 00:31 -0700
Message-ID<a0e00240-90f5-4776-a7a7-15176eedf71c@googlegroups.com>
In reply to#27756
On Thursday, March 13, 2014 11:53:02 PM UTC-7, Navneet Mathpal wrote:
> I wnat to store 20141231246023 but long is out of range in it.
> how to save value in this range.
> is there any unSigned long available??

No.

> I was trying unSigned long but not working ..

That should not surprise you.

Would 'java.math.BigInteger' help you?

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#27759

FromJoerg Meier <joergmmeier@arcor.de>
Date2014-03-14 11:40 +0100
Message-ID<1cb63jgqi411h$.1x08n1uc45m31.dlg@40tude.net>
In reply to#27757
On Fri, 14 Mar 2014 00:31:40 -0700 (PDT), Lew wrote:

>> I was trying unSigned long but not working ..
> That should not surprise you.

It surprises me how many people apparently learn to program by randomly
typing words into their text editor until one turns out to coincidentally
be something the compiler recognizes. It's like learning a second language
by pressing random letters until Word stops putting red squigglies under a
word.

Liebe Gruesse,
		Joerg

-- 
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.

[toc] | [prev] | [next] | [standalone]


#27762

Frommarkspace <markspace@nospam.nospam>
Date2014-03-14 09:40 -0700
Message-ID<lfvbdu$1jk$1@dont-email.me>
In reply to#27759
On 3/14/2014 3:40 AM, Joerg Meier wrote:
> On Fri, 14 Mar 2014 00:31:40 -0700 (PDT), Lew wrote:
>
>>> I was trying unSigned long but not working ..
>> That should not surprise you.
>
> It surprises me how many people apparently learn to program by randomly
> typing words into their text editor until one turns out to coincidentally
> be something the compiler recognizes.


Well all those Perl programmer got started somehow.


[toc] | [prev] | [next] | [standalone]


#27770

FromArivald <arivald_@AT_interia_DOT_.pl>
Date2014-03-17 10:19 +0100
Message-ID<lg6enu$k3u$1@news.dialog.net.pl>
In reply to#27759
W dniu 2014-03-14 11:40, Joerg Meier pisze:
> On Fri, 14 Mar 2014 00:31:40 -0700 (PDT), Lew wrote:
>
>>> I was trying unSigned long but not working ..
>> That should not surprise you.
>
> It surprises me how many people apparently learn to program by randomly
> typing words into their text editor until one turns out to coincidentally
> be something the compiler recognizes. It's like learning a second language
> by pressing random letters until Word stops putting red squigglies under a
> word.

Not really. If someone have experience in C++ or other languages, it is 
natural to try same type names, expecting them.

-- 
Arivald

[toc] | [prev] | [next] | [standalone]


#27813

FromLew <lewbloch@gmail.com>
Date2014-03-22 15:30 -0700
Message-ID<ada19c6c-cd72-4349-872a-af3081b8377f@googlegroups.com>
In reply to#27770
Arivald wrote:
> Joerg Meier pisze:
>> Lew wrote:
>>> The OP wrote:]
>>>> I was trying unSigned long but not working ..
>>> That should not surprise you.
> 
>> It surprises me how many people apparently learn to program by randomly
>> typing words into their text editor until one turns out to coincidentally
>> be something the compiler recognizes. It's like learning a second language
>> by pressing random letters until Word stops putting red squigglies under a
>> word.
> 
> Not really. If someone have experience in C++ or other languages, it is 
> natural to try same type names, expecting them.

Sure, insofar as it's "natural" to try anything utterly stupid.

Here's what's natural to actual computer programmers: looking it up.

For God's sake, the primitive type names are the most, well, primitive facts about the language!

And you make excuses for that baloney?

There's something unnatural there.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#28010

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-04-09 18:06 -0700
Message-ID<3hrbk99o20ndt8g9j5ar8vmdk8rn2msnuu@4ax.com>
In reply to#27813
On Sat, 22 Mar 2014 15:30:35 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>Sure, insofar as it's "natural" to try anything utterly stupid.

the primitives are listed at http://mindprod.com/jgloss/primitive.html
the keywords are at http://mindprod.com/jgloss/keyword.html

Use the index to get a novice-friendly intro to each keyword.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
"Don't worry about people stealing an idea; if it's original, you'll
 have to shove it down their throats." 
~ Howard Aiken (born: 1900-03-08 died: 1973-03-14 at age: 73)

[toc] | [prev] | [next] | [standalone]


#27758

Fromv_borchert@despammed.com (Volker Borchert)
Date2014-03-14 10:24 +0000
Message-ID<lfuldn$eb3$5@Gaia.teknon.de>
In reply to#27756
Navneet Mathpal wrote:

> I wnat to store 20141231246023 but long is out of range in it.
> how to save value in this range.

???

long is signed 64bit: -9223372036854775808 ... 9223372036854775807

If that's too small, use java.math.BigInteger or roll your own
fixed size type consisting of two or four or eight long.

-- 

"I'm a doctor, not a mechanic." Dr Leonard McCoy <mccoy@ncc1701.starfleet.fed>
"I'm a mechanic, not a doctor." Volker Borchert  <v_borchert@despammed.com>

[toc] | [prev] | [next] | [standalone]


#27760

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2014-03-14 08:46 -0400
Message-ID<lfutni$h0m$1@dont-email.me>
In reply to#27756
On 3/14/2014 2:53 AM, Navneet Mathpal wrote:
> hi
> I wnat to store 20141231246023 but long is out of range in it.

     No, the value is well within the range of `long'.  The problem
is that it's *not* within the range of `int', so you cannot write
the value as an `int' constant.  Use 20141231246023L to write a
`long' constant.

> how to save value in this range.
> is there any unSigned long available??

     No.

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#27761

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-03-14 08:42 -0700
Message-ID<jo86i95febaqd5u6hoo3r0di2pokqfkvo2@4ax.com>
In reply to#27756
On Thu, 13 Mar 2014 23:53:02 -0700 (PDT), Navneet Mathpal
<navneetmathpal93@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>I wnat to store 20141231246023 but long is out of range in it.

you can store an unsigned long, but you can't do unsigned arithmetic.

see http://mindprod.com/jgloss/literal.html
for how to do long decimal and hex literals.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
"Incorrect documentation is often worse than no documentation."
~ Bertrand Meyer (born: 1950 age: 63), creator of design by contract 
and the Eiffel language.

[toc] | [prev] | [next] | [standalone]


#27763

FromMarcel Müller <news.5.maazl@spamgourmet.org>
Date2014-03-14 19:53 +0100
Message-ID<53235041$0$9520$9b4e6d93@newsspool1.arcor-online.net>
In reply to#27756
On 14.03.14 07.53, Navneet Mathpal wrote:
> I wnat to store 20141231246023 but long is out of range in it.
> how to save value in this range.

As others said, long is fine.

But I really cannot recommend to use integers for human readable time 
stamps. SAP does this and it is the source of problems all the time.
- The types provides the operators +, -, *, /, % without any reasonable 
result.
- It can represent inconsistent time stamps like Feb 31th.
- Accessing the fields cause the same number of divisions than with a 
linear representation like with java.util.Date.
- And some visualizations end up with 20,141,231,246,023 which is 
entirely unreadable.


Marcel

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web