integer Questions

4

Solved

Is there a succinct operation in JavaScript (ES2015) that does this: x => x === undefined ? 0 : x I keep running into situations where I want to increment x, but it's initially undefined, so ...
Anelace asked 4/1, 2017 at 2:57

6

Solved

I have a data structure: data = array of integer; I have filled it from an source = array of byte; with data[x] := Source[offset] or (Source[offset + 1] shl 8) or (Source[offset + 2] shl 16...
Mono asked 29/11, 2012 at 20:32

5

I tried to run this code, but it showed an error: def shoot(aliens): s=[0]*1000 s[0]=0 s[1]=1 num=len(aliens) b=[[0 for m in range(1000)] for n in range(1000)] for j in xrange(2,num): for i ...
Vorous asked 19/7, 2013 at 20:46

6

With my code, I want to get the last two digits of an integer. But when I make x a positive number, it will take the first x digits, if it is a negative number, it will remove the first x digits. ...
Lilian asked 15/1, 2017 at 18:37

6

Solved

In Java, if we divide bytes, shorts or ints, we always get an int. If one of the operands is long, we'll get long. My question is - why does byte or short division not result in byte or short? Why...
Sauder asked 8/12, 2016 at 8:3

3

Solved

I have a function that I apply to a column and puts results in another column and it sometimes gives me integer(0) as output. So my output column will be something like: 45 64 integer(0) 78 How ...
Latreshia asked 19/1, 2014 at 14:32

9

I need to convert a binary input into a decimal integer. I know how to go from a decimal to a binary: n = int(raw_input('enter a number: ')) print '{0:b}'.format(n) I need to go in the reverse d...
Carabiniere asked 13/2, 2014 at 21:23

6

I have a nvarchar column in one of my tables. Now I need to convert that column values to INT type.. I have tried using cast(A.my_NvarcharColumn as INT) and convert (int, N'A.my_NvarcharCo...
Medallist asked 19/10, 2012 at 5:22

15

Solved

Given a decimal integer (eg. 65), how does one reverse the underlying bits in Python? i.e.. the following operation: 65 → 01000001 → 10000010 → 130 It seems that this task can be broken down into ...
Finisterre asked 1/10, 2012 at 22:20

5

Solved

When I use pandas to read a MySQL table, some columns (see 'to_nlc' in the image below) that used to have an integer type became a floating-point number (automatically append .0). Can anyone figure...
Welborn asked 13/6, 2016 at 18:38

4

Solved

Given {"a": 1234567890}, I want 1,234,567,890 in the result, how this can be done with jq echo '{"a": 1234567890}' | jq '.a | FORMAT?' Thanks for @peak's answer, the solution is echo '{"a": 12...
Varus asked 10/2, 2020 at 10:29

9

Solved

I'm using jQuery to get the height of an element. But if the element doesn't exist, the following code will return NULL: $height = $('#menu li.active ul').height(); // returns integer or null Is...
Whalebone asked 2/9, 2016 at 9:14

4

Solved

I want to divide two numbers in awk, using integer division, i.e truncating the result. For example k = 3 / 2 print k should print 1 According to the manual, Division; because all numbers ...
Yamashita asked 13/2, 2013 at 16:27

7

Solved

Is there any significant difference (in performance or best practices) between those two stream creation methods? int[] arr2 = {1,2,3,4,5,6}; Arrays.stream(arr2) .map((in)->in*2) .mapToObj((...
Duester asked 31/12, 2018 at 9:19

4

Solved

I have a string, and I know that it only contains a number. How can I check if this number is int or float?
Perilous asked 1/4, 2017 at 11:9

6

Solved

How can I convert a string value like "0x310530" to an integer value in C#? I've tried int.TryParse (and even int.TryParse with System.Globalization.NumberStyles.Any) but it does not work...
Greenland asked 25/11, 2010 at 18:21

6

Solved

I am new to C/C++, so I have a couple of questions about a basic type: a) Can you explain to me the difference between int64_t and long (long int)? In my understanding, both are 64 bit integers....
Commend asked 28/11, 2012 at 11:35

7

Solved

How do I get python to accept both integer and float? This is how I did it: def aud_brl(amount,From,to): ER = 0.42108 if amount == int: if From.strip() == 'aud' and to.strip() == 'brl': ab = in...
Ganesha asked 22/4, 2017 at 20:13

5

Solved

I am working on a trading API (activex from interactive brokers)which has a method called: void reqMktDataEx(int tickerId, IContract contract, string generalDetails, int snapshot) The issue is aro...
Schram asked 10/12, 2011 at 14:57

15

Solved

Go's range can iterate over maps and slices, but I was wondering if there is a way to iterate over a range of numbers, something like this: for i := range [1..10] { fmt.Println(i) } Or is there...
Wystand asked 22/2, 2014 at 5:39

17

Solved

So I have this query working (where signal_data is a column) in Sybase but it doesn't work in Microsoft SQL Server: HEXTOINT(SUBSTRING((INTTOHEX(signal_data)),5,2)) as Signal I also have it in E...
Mina asked 31/3, 2009 at 20:56

10

Solved

The stdint.h header lacks an int_fastest_t and uint_fastest_t to correspond with the {,u}int_fastX_t types. For instances where the width of the integer type does not matter, how does one pick the ...
Cashbook asked 12/9, 2010 at 7:54

6

Solved

Here is my code : Int -> ByteArray private fun write4BytesToBuffer(buffer: ByteArray, offset: Int, data: Int) { buffer[offset + 0] = (data shr 24).toByte() buffer[offset + 1] = (data shr 16).t...
Lully asked 20/4, 2021 at 12:47

34

Solved

Can anyone explain to me how to reverse an integer without using array or String. I got this code from online, but not really understand why + input % 10 and divide again. while (input != 0) { re...
Vowelize asked 27/9, 2010 at 17:13

9

Solved

I'm trying to make a method that converts an integer that represents bytes to a string with a 'prettied up' format. Here's my half-working attempt: class Integer def to_filesize { 'B' => 10...
Rumpus asked 15/4, 2013 at 23:2

© 2022 - 2024 — McMap. All rights reserved.