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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
62 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; } ...
magician's user avatar
0 votes
0 answers
52 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 =...
Neha's user avatar
  • 109
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 ...
Remy's user avatar
  • 4,903
0 votes
1 answer
126 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. ...
Utkarsh's user avatar
-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 ...
VitalyT's user avatar
  • 1,681
3 votes
1 answer
111 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&...
Chaitanya's user avatar
  • 719
2 votes
2 answers
68 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"); ...
sai praveen's user avatar
1 vote
1 answer
59 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 ...
sai praveen's user avatar
-1 votes
2 answers
65 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 ...
Michał Jagodzinski's user avatar
0 votes
1 answer
2k 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 ...
Jeff M's user avatar
  • 375
0 votes
0 answers
12 views

Trades won't close at set stop and profit level

I am creating a simple long/short pinescript. I want my long trades to close with +6% profit and close when -4% in loss. For my shorts I want it to close with +3% profit and when -2% in loss. Current ...
Pieter hein's user avatar
0 votes
0 answers
15 views

Hindi Language URL Redirection 404 error show is not working in safari

"Hi, I have a WordPress website where we post content in Hindi. We shared a post via WhatsApp, but when we tried to open the link in Safari, the post wouldn't load. However, the same link worked ...
chandrashekhar's user avatar
0 votes
0 answers
34 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 ...
josh's user avatar
  • 7
2 votes
1 answer
149 views

How to convert array of 16-bit signed integers to byte array in Java?

Let's say that on Android (Java) we have a byte array that represents a sequence of 16-bit signed integers. I am needing to be able to decode the values from this array by using a for-loop and ...
Nerdy Bunz's user avatar
  • 6,481
1 vote
0 answers
101 views

Firebase dynamic link short url is not working while redirecting one domain to another domain in firebase hosting (Long link is working good)

I had redirect my new domain to old domain in firebase hosting, Everything fine in this except dynamic short url is not working, it shows dynamic url is not found, Long url is working good, Please ...
Flutter's user avatar
  • 133
0 votes
0 answers
95 views

Calculating and Drawing a Triangle - Python Beginner

Please Please Please help :) The objective of this program is to randomly generate three side lengths of a triangle, check if those side lengths can make a triangle, calculate the angles of the ...
PersonAnon's user avatar
0 votes
1 answer
42 views

Short-Circuit property C

According to the short-circuit property in C:0&&(anything) gives 0 and 1||(anything) gives 1. so according to the property-0&&5||6&&7||4&&!6,this should give us 0. But ...
Subham Bhuyan's user avatar
0 votes
0 answers
33 views

How to increase ShortCache high value in Java

The following options set the high value for IntegerCache in Java: -XX:AutoBoxCacheMax=42000 -Djava.lang.Integer.IntegerCache.high=21000 But the following doesn't seem to work -Djava.lang.Short....
Serge Rogatch's user avatar
0 votes
1 answer
29 views

Count occurance of 2 list, but without duplicate the counter

I have to count the occurrence between two lists of strings. I need this function to complete my mastermind game. The problem is that I manage to count the occurrences but they are duplicated because ...
Louis Gurita's user avatar
1 vote
1 answer
56 views

How the short type is represented by the Visual C++ compiler? [duplicate]

I know that most significant bit means the sign of a number in signed types. But I found one strange (for me) thing: if the number is negative and we use short type, this number will look like 0xffff##...
Igorka's user avatar
  • 11
4 votes
1 answer
265 views

division of short returns int c# (short/short=int ?!)

I'm trying the following: short value1 = 4; short value2 = 2; short result = value1 / value2; Cannot implicitly convert type 'int' to 'short'. An explicit conversion exists (are you missing a cast?) ...
julian bechtold's user avatar
0 votes
1 answer
584 views

How do I convert a short to an int without turning it into a negative in java

I am working on a file reader and came into a problem when trying to read a short. In short (punintended), java is converting a two bytes I'm using to make the short into an int to do bitwise ...
BREgitLEEhub2222's user avatar
0 votes
1 answer
101 views

Adding Int array values in the set of type short

public class Solution { public Set<Short> setx = new HashSet<>(); public void AddAll(int[] numbers) { for (int number : numbers) { setx.addAll((short) number); ...
Rahela Sadaf's user avatar
1 vote
1 answer
1k views

Difference between smallint and short?

Whats the difference between smallint and short in spark sql?
Jahnavi's user avatar
  • 11
0 votes
0 answers
135 views

mips read int from user as half word

well , i have this assignment below in mips that requires read three integer form the user as short (half-word),my problem is how to read and store this integer as half word . I wrote the program but ...
محمد العرادي's user avatar
-1 votes
2 answers
87 views

Shorten for-loops into one

is it possible to shorten these three for loops into one the code works absolutely fine, I just want to know if there is a possibility to shorten these three for loops into one for exercising reasons ...
the Lorde's user avatar
0 votes
0 answers
128 views

Is it okay to declare a variable as Byte then convert to Int in Kotlin?

So i want to use Byte and Short to decrease memory usage, but some methods asks explicitly for Int. private val numberOne : Byte = 50 someMethodAskingInt(numberOne.toInt()) If i convert a variable to ...
aweirdtrashcan's user avatar
1 vote
2 answers
131 views

Short and byte data types don't work in loop [duplicate]

I can't add two short numbers when they are in a loop, but when they outside loop they adds well. Byte type behaves the same. But with integers everything works well. Why does this happening? Java, ...
humankind's user avatar
1 vote
1 answer
53 views

Want another way shortcode about sqlcode

please, i want find another way example data date tomato phone book pen 2022-05-15 2 2 3 1 2022-05-15 3 3 3 2 i see this result date tomato phone book pen 2022-05-15 5 5 6 3 i use this insert ...
pozuhtuhv's user avatar
0 votes
1 answer
414 views

I don't understand why I get the compiler error "Lossy conversion from int to short"

For this code: public class Solution{ public static void main(String[] args){ short x = 10; x = x * 5; System.out.print(x); ...
futuredeveloper's user avatar
0 votes
1 answer
1k views

QT String to short int - Hex Value

I want to convert QString to short int. For eg, Input: QString str = "0x0001"; Output: short int num = 0x0001; I have tried toShort() method of QString but it converts "0x0024" to ...
Akshay Shelke's user avatar
-1 votes
1 answer
563 views

QByteArray to short Int array in QT C++

I am receiving a QByteArray from UDP Socket. The QByteArray is of 52 elements each containing values from 0 to 9 - A to F. Now, I want to convert this QByteArray into a short int array of 13 elements ...
Soham Patel's user avatar
0 votes
1 answer
44 views

Issues converting Hex to Short getting the wrong value

I have a function that converts 2 char values into an unsigned short: unsigned short ToShort(char v1, char v2) { unsigned short s = ((v1 << 8) | v2); return s; } It works most of the ...
Justin Barren's user avatar
0 votes
2 answers
120 views

Is there a way to write a method that outputs the number of digits before the decimal point of a float parameter as a short?

I need to output the total number of digits before the decimal point of a float number and output the results as a short. This is what I have so far: public static void main(String[] args) { ...
kaser 4886's user avatar
0 votes
2 answers
383 views

C++ casting char into short

Pardon me for this newbie question. I recently found that a strange thing when casting char into short. Basically, if the char is overflowed, when casting into short the binary number is prepended ...
jleng's user avatar
  • 55
0 votes
3 answers
1k views

Printf in unsigned short int and unsigned int using %d

Why in second printf when using %d I am not getting -1? #include<stdio.h> int main(){ unsigned int u=-1; unsigned short int y=-1; printf("%d %u\n",u,u); printf("%d ...
Sameer Raj's user avatar
1 vote
2 answers
314 views

converted an integer to short in C, get 4-byte when printed short

I converted an integer value to short, but when I printed the hexadecimal result of short, it was shown in 4-bytes, I can't find the reason. #include <stdio.h> void main() { int j = 53191; ...
Hafeez's user avatar
  • 11
1 vote
1 answer
568 views

Printf with short integer compiler warning

#include <stdio.h> int main(void) { short i = 1; printf("%hd\n", i); printf("%hd\n", i * i); return 0; } Compiling this gives the warning warning: format specifies ...
The Skylur's user avatar
0 votes
2 answers
39 views

I'm getting the value of b as 2130 can anyone explain me the process and tell me why?

public class Main { public static void main(String[] args) { byte x = 126; short y = 32734; int z = 32789; long a = 50000L + 10L * (x + y + z); System.out.println(a); short b = ...
sahilcrazyy's user avatar
1 vote
0 answers
112 views

What is GCC's un-optimized asm doing to add two short ints in assembly?

In this code example typedef struct { short int a1; short int a2;} st1; typedef struct { int sum; int diff;} st2; st2 test (st1 s1) { st2 store; store.sum = s1.a1 + s1.a2; store.diff = s1....
user avatar
-3 votes
2 answers
88 views

Change part of the bits in a short in C++? [closed]

I have packed data of rgba values in an 16 bit short, so for each channel goes 4bit, how can I change specific channel only, lets say I want to change red channel to it's value devided by two. I know ...
G.Azma's user avatar
  • 37
0 votes
2 answers
758 views

Pointer Arithmetic long and short in 32bit or 64bit System

I am just studying for an exam and the following question is asked, what output does the following program generate in 32 bit or 64 bit? #include <stdio.h> int main(int argc, char **argv) { ...
Joe Daniel's user avatar
0 votes
1 answer
76 views

Separate bits from short[] in order of most to least significant C#

I want to separate the bits of a short[] contained in a byte[] so the most significant bit of each short are arranged in one contiguous block(array? line?) followed by the next bit from each short and ...
CommanderLake's user avatar
1 vote
1 answer
383 views

Short unsigned int in C++ [duplicate]

So in my exam in the class I was supposed to declare X as a short unsigned. I declared it short unsigned int X. Is this way still OK and correct? Thank you
Bokacc's user avatar
  • 13
0 votes
1 answer
481 views

Convert a binary number from type short into a decimal number in C

I need to read from a file a binary number that is represented by type short in C language. the number represents the size of an array so after I read it I want to use the number as a decimal value. I ...
Niv Neuvirth's user avatar
0 votes
1 answer
287 views

Assigning a short to int * fails

I understand that I can reassign a variable to a bigger type if it fits, ad its ok to do it. For example: short s = 2; int i = s; long l = i; long long ll = l; When I try to do it with pointers it ...
piptin's user avatar
  • 365
0 votes
1 answer
1k views

Can I get the robocopy log file to just display one line of the summary and date? instead of having multiple columns? thank you

So far I have this code to just show the summary of the robocopy. Can I just make this really short and 1 line? Like a line that shows the total size copied, the date, and if it was successful or ...
tricky69's user avatar
1 vote
0 answers
125 views

std::ofstream doesn't work with short enums in C++Builder 10.3

If I set "Short enums" to true (Project -> Options -> C++ Compiler), I receive an Access Violation in return from a function where std::ofstream is used. Example code: #include <...
user3575468's user avatar
0 votes
0 answers
59 views

I would like to change ugly address link on my subpages of galleria (Gallery)

grimlord.eu/galeria and its subpages has ugly adress. http://www.grimlord.eu/index_pl.php?src=gallery&sub=koncertowe http://www.grimlord.eu/index_pl.php?src=gallery&sub=studio http://www....
yansen's user avatar
  • 11
1 vote
1 answer
727 views

Deprecated Short(String) how to update?

I'm handling this problem: produto.setQuantidade(new Short("7")); Short appears deprecated with a mark. How can I update this for above Java 9 versions? (Now, I have Java 11)
Marcel Motta's user avatar

1
2 3 4 5
13