Questions tagged [int64]

The int is a datatype that represents an integer and is coded on 64 bits in memory.

int64 is a datatype that represents an (a whole number, not a fraction) and is coded on 64 bits in memory. Unlike its counterpart which is , int64 can be used to store positive and negative integers of values between -263 to 263 - 1.

260 questions
133
votes
3 answers

Golang converting string to int64

I want to convert a string to an int64. What I find from the strconv package is the Atoi function. It seems to cast a string to an int and return it: // Atoi is shorthand for ParseInt(s, 10, 0). func Atoi(s string) (i int, err error) { i64,…
user1663023
53
votes
4 answers

what is the performance impact of using int64_t instead of int32_t on 32-bit systems?

Our C++ library currently uses time_t for storing time values. I'm beginning to need sub-second precision in some places, so a larger data type will be necessary there anyway. Also, it might be useful to get around the Year-2038 problem in some…
oliver
  • 6,204
  • 9
  • 46
  • 50
50
votes
4 answers

node.js - Is there any proper way to parse JSON with large numbers? (long, bigint, int64)

When I parse this little piece of JSON: { "value" : 9223372036854775807 } This is what I get: { hello: 9223372036854776000 } Is there any way to parse it properly?
tartakynov
  • 2,768
  • 3
  • 26
  • 23
48
votes
3 answers

How to convert an int64 to int in Go?

In Go, what is the best strategy for converting int64 to int? I am having difficulty comparing the two package main import ( "math" "strings" "strconv" ) type largestPrimeFactor struct { N int Result int } func main() { …
pward
  • 1,049
  • 1
  • 8
  • 17
45
votes
3 answers

Should I use long long or int64_t for portable code?

I have an open-source codebase that is written in both C and C++. I'm looking for an integer type that is guaranteed to be at least 64 bits wide, which can be reliably compiled on most OS X (Intel, 64-bit) and Linux boxes with open-source C and C++…
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
35
votes
3 answers

What is the int.MaxValue on a 64-bit PC?

System.Console.WriteLine(int.MaxValue); This line gives me the answer of 2,147,483,647 as I have a 32-bit PC. Will the answer be same on a 64-bit PC?
g.revolution
  • 11,962
  • 23
  • 81
  • 107
35
votes
5 answers

How to convert tf.int64 to tf.float32?

I tried: test_image = tf.convert_to_tensor(img, dtype=tf.float32) Then following error appears: ValueError: Tensor conversion requested dtype float32 for Tensor with dtype int64: 'Tensor("test/ArgMax:0", shape=TensorShape([Dimension(None)]),…
Yee Liu
  • 1,417
  • 3
  • 15
  • 17
33
votes
10 answers

Generate random values in C#

How can I generate random Int64 and UInt64 values using the Random class in C#?
SyncMaster
  • 9,754
  • 34
  • 94
  • 137
33
votes
2 answers

Isn't an Int64 equal to a long in C#?

I have been playing around with SQL and databases in C# via SqlCeConnection. I have been using ExecuteReader to read results and BigInt values for record IDs which are read into Longs. Today I have been playing with SQL statements that use COUNT…
user427165
31
votes
1 answer

How can I print out an constant uint64 in Go using fmt?

I tried: fmt.Printf("%d", math.MaxUint64) but I got the following error message: constant 18446744073709551615 overflows int How can I fix this? Thanks!
abw333
  • 5,571
  • 12
  • 41
  • 48
26
votes
7 answers

How to convert string to int64_t?

How to convert program parameter from argv to int64_t? atoi() is suitable only for 32 bit integers.
pmichna
  • 4,800
  • 13
  • 53
  • 90
23
votes
3 answers

How to input int64_t / uint64_t constants?

What I'm trying to do is to define a constant equal to 2^30 (I may change it to something like 2^34, so I prefer to have a room larger than 32 bits for it). Why the following minimal(?) example doesn't compile? #include // test.cpp:4:33:…
fiktor
  • 1,303
  • 2
  • 11
  • 22
23
votes
2 answers

strconv.Itoa64(1234) gives undefined in golang

This is my code: package main import ( "strconv" "fmt" ) func main() { t := strconv.Itoa64(1234) fmt.Println(t) } Problem: Why does it cause the following error message? command-line-arguments .\test.go:7: undefined:…
Yster
  • 3,147
  • 5
  • 32
  • 48
21
votes
4 answers

Do I need to have 64 bit Processor to use 64 bit data type

I have a few questions: Do I need to have 64 bit Processor to use 64 bit data type(__int64 or int64_t) ? What means by, the "t" of int64_t? Starting from what version of GCC and VCC are supporting data type? Is the 64 bit data type are just…
Quazi Irfan
  • 2,555
  • 5
  • 34
  • 69
21
votes
4 answers

In Swift, how do you convert a String to Int64?

I am loading in lines from a text file with very large numbers. String has the toInt method, but how do you convert a string to an Int64 which will be able to handle the large numbers? I don't see a toInt64 method or a toLong etc. There must be a…
shim
  • 9,289
  • 12
  • 69
  • 108
1
2 3
17 18