signed

If the floating-point number storage on a certain system has a sign bit, a 3-bit exponent, and a 4-bit significand:

一世执手 提交于 2021-02-10 06:14:11
问题 (Assume no bits are implied, there is no biasing, exponents use two’s complement notation, and exponents of all zeros and all ones are allowed.) I am trying to find the largest and smallest number that can be represented if the system is normalized. I thought that the largest number would be: .1111 x 2^4 = 0 100 1111 = 15 and the smallest: 1.0 x 2^-4 = 0 000 0001 = 0.0625 But the answers that I saw were: Largest: .1111 x 2^3 = 111.1 = 7.5 Smallest: 0.1 x 2^-4 = .00001 = 0.03125 I do not

what happens when we do mov eax , -4?

僤鯓⒐⒋嵵緔 提交于 2021-02-05 12:21:02
问题 I know that -4 is copied into the EAX register. My doubts: -4 will be converted into two's complement binary notation before copying to EAX or not? If it is converted into two's complement binary notation , who does the job? Is there any special opcode for denoting negative numbers? What is the possible maximum negative number we can store in EAX register? Is there any special opcode or instructions for signed arithmetic? what happens when we multiply a negative and positive number in CPU?

Why does this code contains colon in struct?

孤街浪徒 提交于 2021-02-05 09:31:11
问题 Please explain how this code is executing.why we has used ":" in structures.what is the use of colon in structures.what should be the output of sizeof operator. #include <stdio.h> int main() { struct bitfield { signed int a : 3; unsigned int b : 13; unsigned int c : 1; }; struct bitfield bit1 = { 2, 14, 1 }; printf("%ld", sizeof(bit1)); return 0; } 回答1: The : operator is being used for bit fields, that is, integral values that use the specified number of bits of a larger space. These may get

Implicit conversion warning with own getch function

时间秒杀一切 提交于 2021-01-29 07:19:14
问题 I found a c implementaion of conio.h's getch(). Sadly it compiles with a comversion warning, and i don't know what i should do to solve it correctly. I found this link, but i don't know how to implement it. #include<termios.h> #include<unistd.h> #include<stdio.h> #include"getch.h" /* reads from keypress, doesn't echo */ int getch(void) { struct termios oldattr, newattr; int ch; tcgetattr( STDIN_FILENO, &oldattr ); newattr = oldattr; newattr.c_lflag &= ~( ICANON | ECHO ); tcsetattr( STDIN

Signed and unsigned integers?

妖精的绣舞 提交于 2021-01-28 07:58:56
问题 Could someone please explain the two to me because I have to give an explanation of them both in my assignment. I know what a normal integer is of course and have used the following to describe it: "An integer is a whole number which can be positive, negative and zero but it cannot have decimal points." But I'm just not sure about signed and unsigned. Thanks 回答1: In most languages when you declare an integer, you are declaring a signed integer. If you want to declare an unsigned integer you

The difference between signed and unsigned, what means a negative byte?

二次信任 提交于 2021-01-28 07:02:41
问题 I need to solve the problem below, but I don't understand the concepts needed for solution. Let's consider the following string of doublewords: B234* A68C *h, * 52B4 *78C8h, * 1AB3 *C470h, F9DC* 98B6 *h. It is required to: 1) print on the screen the words ' ranks that have the minimum value from each doubleword (considering them unsigned ) The answer is '2112' (the bold words have the minimum value) 2) print on the screen the sum of the bytes that have the maximum value from these words

Cordova signed apk produces a blank screen after splash screen

你说的曾经没有我的故事 提交于 2021-01-27 16:07:48
问题 Cordova debug build working fine. But signing apk produces white screen after splash screen Already tried with creating new app and signing with the release key. But the same issue on signed apk. cordova version - 7.1.0 cordova platform android -> 7.1.0 Here are plugins that i'm using: - cordova plugin add cordova-plugin-camera cordova plugin add - cordova-plugin-dialogs@~2.0.1 cordova plugin add - cordova-plugin-file@~6.0.1 cordova plugin add - cordova-plugin-geolocation@~4.0.1 cordova

Is `int` always signed?

时间秒杀一切 提交于 2021-01-27 04:17:04
问题 I always thought that in C, int stands for signed int ; but I have heard that this behavior is platform specific and in some platforms, int is unsigned by default. Is it true? What says the standard, and has it evolved over time? 回答1: You are quite right. As per C11 (the latest c standard), chapter §6.7.2 int , signed , or signed int is categorized as same type (type specifiers, to be exact). So, int is the same as signed int . Also, re-iterating the same, from chapter §6.2.5/P4 There are

Should I use “mul” or “imul” when multiplying a signed number to an unsigned number?

爷,独闯天下 提交于 2021-01-01 04:19:30
问题 I have found out that both mul and imul can be used to multiply a signed number to an unsigned number. For example: global _start section .data byteVariable DB -5 section .text _start: mov al, 2 imul BYTE [byteVariable] You can replace imul with mul , and the result would still be the same ( -10 ). Are mul and imul exactly the same when multiplying a signed number to an unsigned number, or is there a difference between them? 回答1: The upper half is different, as mentioned in the comments. If

How to detect encodings on signed integers in C?

一曲冷凌霜 提交于 2020-12-28 18:31:56
问题 The ISO C standard allows three encoding methods for signed integers: two's complement, one's complement and sign/magnitude. What's an efficient or good way to detect the encoding at runtime (or some other time if there's a better solution)? I want to know this so I can optimise a bignum library for the different possibilities. I plan on calculating this and storing it in a variable each time the program runs so it doesn't have to be blindingly fast - I'm assuming the encoding won't change