Questions tagged [short]
A short integer is an integer number which may take less storage, while having a smaller range, than a standard integer on the same machine.
short
630
questions
-1
votes
1
answer
41
views
I want to convert long url to short url in last having ... how to do that
I want to convert long url to short in last having ... dots. For example this url
This is long url
text
Now, Short url
text
The code available long url to short url in above link. I am trying hard ...
0
votes
0
answers
25
views
possible lossy conversion from int to short but I have no int variable
I was writing a code to print out the reverse of the 4-digit numbers, so my maximum number is 9999 and below 32767(maximum value of short) . The code is :
public class Project2{
public static void ...
0
votes
1
answer
89
views
Are there any examples of architectures in which int cannot represent all values of unsigned short despite latter being shorter?
Are there any known examples of architectures out there in which unsigned short is smaller than int yet still only representable by unsigned int after conversion?
1
vote
1
answer
135
views
Is there any way to tell the compiler that an integer type need not be truncated?
take this code snippet
void thing(signed short ss);
void test(int i){
thing((signed short)i);
}
both gcc and clang generate
movswl %di, %edi
jmp thing(int)
however I know ...
0
votes
0
answers
63
views
Confusion about Casting among Signed and Unsigned [duplicate]
Recently I am learning about casting among data type. So I try this:
unsigned int a = 4294967295;
int b = -1;
if (a == b) {
cout << "a == b" << endl;
} ...
0
votes
0
answers
56
views
Getting error while passing short[] to function using jpa
I have created a function as below :
CREATE OR REPLACE FUNCTION demo(ids SMALLINT[])
RETURNS TABLE (processkey bigint)
AS $$
BEGIN
RETURN QUERY SELECT b.processkey FROM your_table b WHERE id_column =...
0
votes
0
answers
38
views
Signed short does not accept hex value above 0x7FFF [duplicate]
When trying to assign a value to a signed short I am unable to assign a value that would wrap around to be a negative value. Take the following assignments:
short a = 0xFF87; //Cannot be converted to ...
0
votes
1
answer
296
views
Why I can't perform mathematical operations using short variable? [duplicate]
short s1 = 4500, s2 = 9800;
short s3;
s3 = s2 - s1;
System.out.println("The difference is:- " + s3);
I ran this code and it is showing an error but work perfectly when I declare s3 as int. ...
-1
votes
1
answer
73
views
Convert short number to byte array java
my purpose to read from stream as byte per digit do some logic and write back to binary file
Lets say the representation of data is 0F000200 17000000 07003B00
so we have method to represent it
...
3
votes
1
answer
286
views
How to initialise Short array in Kotlin?
There are multiple ways to declare and initialise Arrays in Kotlin. An Array<Short> can be initialised in the following ways -
val shortArr1 = shortArrayOf(1,2,3,4,5)
//or
val shortArr2: Array&...
2
votes
2
answers
88
views
Why isn’t implicit type conversion happening from unsigned short int to signed char?
code 1:
#include <stdio.h>
int main()
{
short int a = -1; // ----> Line 1
unsigned int b = 122; // ----> Line 2
if (a > b)
printf("a is big");
...
1
vote
1
answer
78
views
Does implicit typecasting in C maintain the same rank for char and short variables?
In C programming the implicit typecasting order from Higher to lower:
is the rank of char and short same here, means there is no implicit conversion from char to short or short to char right?
char is ...
0
votes
2
answers
76
views
How to read 2 bytes symbols in java into short? [closed]
So f.e. i have a file ala.xs that contains: "sąłs" and i would like to read those symbols from this file and then put them into the table of shorts and then printf them on stdout. I am ...
0
votes
1
answer
3k
views
using openai to call openai.Completion.create the response is shorter than what chatgpt returns
I have a paid account for chatgpt and using the latest 4 version, when I ask it to answer a question it send back a response that is like 4k characters. When I use the api for same question, I get ...
0
votes
0
answers
41
views
Splitting and Replacing - and — in a string
Problem Description:
I just discover that there is at least 2 types of dash actually 3 anyway. I get a list of files:
result = list(desktop.glob("*.pdf"))
Each line of result is a string ...