The talk covers common misunderstood semantics of integer arithmetic with some simple rules of thumb for minimising mistakes. It covers the arithmetic operators, integer overflow and integral promotion rules.
In DBMS (DataBase Management System), the relation algebra is important term to further understand the queries in SQL (Structured Query Language) database system. In it just give up the overview of operators in DBMS two of one method relational algebra used and another name is relational calculus.
Nezkrácená verze mé úvodní přednášky na konferenci "Internet a technologie 21", kterou uspořádalo sdružení CZ.NIC dne 10.6.2021 (a která se konala on-line). Přímo na konferenci zazněla zkrácená verze v délce 20 minut, tato nezkrácená verze má 65 minut.
Video s přednáškou (a komentářem) je dostupné na adrese https://youtu.be/oAKxIq7MA3A
Přednáška je pojata jako úvod do problematiky elektronické identifikace, s vysvětlením základních pojmů z oblastni praxi i právní úpravy. Konkrétně jsou probírány pojmy:
- elektronická identita vs. uživatelský účet
- atributy (elektronické identity)
- elektronická identifikace
- autentizace, autentizační faktory
- autorizace
- poskytovatel identity (IdP, Identity Provider)
- poskytovatel služeb (SeP, Service Provider)
- principy Same Sign On a Single Sign On
- federace identit
a z oblasti práva pak:
- systém elektronické identifikace
- kvalifikovaný systém (el. identifikace)
- kvalifikovaný správce
- prostředek elektronické identifikace
- kvalifikovaný prostředek
- úroveň záruky
- kvalifikovaný poskytovatel
- národní bod (pro identifikaci a autentizaci)
- Národní identitní autorita (NIA)
- zaručená identita
- bankovní identita, SONIA, BankID
In DBMS (DataBase Management System), the relation algebra is important term to further understand the queries in SQL (Structured Query Language) database system. In it just give up the overview of operators in DBMS two of one method relational algebra used and another name is relational calculus.
Nezkrácená verze mé úvodní přednášky na konferenci "Internet a technologie 21", kterou uspořádalo sdružení CZ.NIC dne 10.6.2021 (a která se konala on-line). Přímo na konferenci zazněla zkrácená verze v délce 20 minut, tato nezkrácená verze má 65 minut.
Video s přednáškou (a komentářem) je dostupné na adrese https://youtu.be/oAKxIq7MA3A
Přednáška je pojata jako úvod do problematiky elektronické identifikace, s vysvětlením základních pojmů z oblastni praxi i právní úpravy. Konkrétně jsou probírány pojmy:
- elektronická identita vs. uživatelský účet
- atributy (elektronické identity)
- elektronická identifikace
- autentizace, autentizační faktory
- autorizace
- poskytovatel identity (IdP, Identity Provider)
- poskytovatel služeb (SeP, Service Provider)
- principy Same Sign On a Single Sign On
- federace identit
a z oblasti práva pak:
- systém elektronické identifikace
- kvalifikovaný systém (el. identifikace)
- kvalifikovaný správce
- prostředek elektronické identifikace
- kvalifikovaný prostředek
- úroveň záruky
- kvalifikovaný poskytovatel
- národní bod (pro identifikaci a autentizaci)
- Národní identitní autorita (NIA)
- zaručená identita
- bankovní identita, SONIA, BankID
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
C language supports a rich set of built-in operators. An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. Operators are used in program to manipulate data and variables.
This is a little presentation for those interested in learning C#. I find it useful to present this to new clients to see where they are at in the the programming curve.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSveerababupersonal22
It consists of cw radar and fmcw radar ,range measurement,if amplifier and fmcw altimeterThe CW radar operates using continuous wave transmission, while the FMCW radar employs frequency-modulated continuous wave technology. Range measurement is a crucial aspect of radar systems, providing information about the distance to a target. The IF amplifier plays a key role in signal processing, amplifying intermediate frequency signals for further analysis. The FMCW altimeter utilizes frequency-modulated continuous wave technology to accurately measure altitude above a reference point.
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...ssuser7dcef0
Power plants release a large amount of water vapor into the
atmosphere through the stack. The flue gas can be a potential
source for obtaining much needed cooling water for a power
plant. If a power plant could recover and reuse a portion of this
moisture, it could reduce its total cooling water intake
requirement. One of the most practical way to recover water
from flue gas is to use a condensing heat exchanger. The power
plant could also recover latent heat due to condensation as well
as sensible heat due to lowering the flue gas exit temperature.
Additionally, harmful acids released from the stack can be
reduced in a condensing heat exchanger by acid condensation. reduced in a condensing heat exchanger by acid condensation.
Condensation of vapors in flue gas is a complicated
phenomenon since heat and mass transfer of water vapor and
various acids simultaneously occur in the presence of noncondensable
gases such as nitrogen and oxygen. Design of a
condenser depends on the knowledge and understanding of the
heat and mass transfer processes. A computer program for
numerical simulations of water (H2O) and sulfuric acid (H2SO4)
condensation in a flue gas condensing heat exchanger was
developed using MATLAB. Governing equations based on
mass and energy balances for the system were derived to
predict variables such as flue gas exit temperature, cooling
water outlet temperature, mole fraction and condensation rates
of water and sulfuric acid vapors. The equations were solved
using an iterative solution technique with calculations of heat
and mass transfer coefficients and physical properties.
4. Integer arithmetic
Integers are values, not collections of bits.
Two separate abstraction levels
Bits
Values
Storage
Integer values
with algebraic properties
5. Agenda
• values and storage
bits vs. Values
• Integer arithmetic
bitwise vs. arithmetic operators
• Integer overflow
• Integral promotion rules
unsigned integer promotion
14. Integer arithmetic
• division /, addition +, subtraction -, multiplication *,
modulus %
operates on integers values
• AND &, OR |, NOT ~, XOR ^
operates on independent bits (storage)
• shift left <<, shift right >>
technically arithmetic operators, but want to be bitwise
16. Integer arithmetic
right-shift on integers are defined in terms of mathematical
properties
E1 >> E2
If E1 has an unsigned type or if E1 has a signed type and a
non-negative value, the value of the result is the integral
part of the quotient of E1/2E2.
17. Integer arithmetic
Implementation defined for negative integers
E1 >> E2
If E1 has an unsigned type or if E1 has a signed type and a
non-negative value, the value of the result is the integral
part of the quotient of E1/2E2.
If E1 has a signed type and a negative value, the resulting
value is implementation-defined.
19. Integer arithmetic
if E1 has a signed type and non-negative value, and E1×2E2
is representable in the corresponding unsigned type of the
result type, then that value, converted to the result type,
is the resulting value; otherwise, the behavior is undefined.
left-shift has undefined behavior on negative integers and
implementation defined behavior when shifting out-of-range
E1 << E2
20. Integer arithmetic
left-shift has undefined behavior on negative integers and
implementation defined behavior when shifting out-of-range
E1 << E2
010 . . . . . .
21. Integer arithmetic
shift- and bitwise operators have non-trivial behavior on
signed integers.
Bitwise operators on signed integers depend on the
implementation defined representation
Bits
Signed
Values
Arithmetic operators
Bitwise operators
Implementation
defined mapping
23. Integer arithmetic
• unary - on unsigned integers
unsigned int a = 0;
unsigned int b = -a;
b == 232 - 0
The negative of an unsigned quantity is computed
by subtracting its value from 2n, where n is the
number of bits in the promoted operand.
27. Agenda
• values and storage
bits vs. values
• Integer arithmetic
bitwise vs. arithmetic operators
• Integer overflow
• Integral promotion rules
unsigned integer promotion
28. Integer overflow
• Signed integer overflow has undefined behavior
• Any defined behavior is worse
• You'll get the wrong answer either way
If during the evaluation of an expression, the result is not
mathematically defined or not in the range of representable
values for its type, the behavior is undefined.
29. Integer overflow
• Signed integer overflow has undefined behavior
• Any defined behavior is worse
• You'll get the wrong answer either way
• Unsigned integers don’t have overflow, as they use
modular arithmetic
If during the evaluation of an expression, the result is not
mathematically defined or not in the range of representable
values for its type, the behavior is undefined.
30. Integer overflow
• For symbolic simplification of expressions, they must implement
regular algebra. e.g.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
x = (-2 - b) / 2 + 10
31. Integer overflow
x = (-2 - b) / 2 + 10
x = -2 / 2 - b / 2 + 10
• For symbolic simplification of expressions, they must implement
regular algebra. e.g.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
32. Integer overflow
x = (-2 - b) / 2 + 10
x = -2 / 2 - b / 2 + 10
x = -1 - b / 2 + 10
• For symbolic simplification of expressions, they must implement
regular algebra. e.g.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
33. Integer overflow
x = (-2 - b) / 2 + 10
x = -2 / 2 - b / 2 + 10
x = -1 - b / 2 + 10
x = 9 - b / 2
• For symbolic simplification of expressions, they must implement
regular algebra. e.g.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
34. • For symbolic simplification of expressions, they must implement
regular algebra. e.g.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
Integer overflow
x = (-2 - b) / 2 + 10
x = -2 / 2 - b / 2 + 10
x = -1 - b / 2 + 10
x = 9 - b / 2
x = 9 - (b >> 1)
If the hardware supports
shifting negative numbers
35. Integer overflow
• Modular arithmetic
• introduces discontinuities in the value space
• Symbolic simplification of expressions much harder.
Less likely to be optimized
• unsigned integers have these properties
36. A is promoted to unsigned.
(a - b) / 2 is not continuous.
cannot be factored out to: a / 2 - b / 2
Integer overflow
• Same example. If b is unsigned.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
x = (-2 - b) / 2 + 10
x = -2 / 2 - b / 2 + 10
37. • Same example. If b is unsigned.
x = (a - b) / c + 10
Given a=-2, c=2 through constant propagation:
Actual expression with modulo
semantics (i.e. unsigned)
Integer overflow
x = ((((-2 - b) % 2n) / 2) % 2n) + 10) % 2n
41. • Use signed integers for values that require normal
arithmetic.
• Use unsigned integers for:
• flags (without arithmetic operators)
• IDs (without arithmetic operators)
• enumerations (enum class)
• bits (only used with bitwise operators)
Integer arithmetic
42. Agenda
• values and storage
bits vs. values
• Integer arithmetic
bitwise vs. arithmetic operators
• Integer overflow
• Integral promotion rules
unsigned integer promotion
44. Integral promotion
Integers are promoted to int before applying operators
uint16_t a = …;
uint16_t b = …;
uint16_t c = a + b;
45. Integral promotion
Integers are promoted to int before applying operators
uint16_t a = …;
uint16_t b = …;
uint16_t c = a + b;
uint16_t c = int(a) + int(b);
As if all built-in operators
only take int parameters
46. Integral promotion
• Assuming int ≡ std::int32_t. this causes an overflow
and fail
int32_t c1 = 2’000’000’000;
int32_t c2 = 3;
int32_t c3 = 4;
int64_t result = c1 * c2 / c3;
Intermediate type is int32_t
OVERFLOW!
47. Integral promotion
• ints and wider integral types are promoted to the
highest ranking type
• wider types rank higher
• At same width, unsigned has higher rank
48. Integral promotion
• ints and wider integral types are promoted to the
highest ranking type
• wider types rank higher
• At same width, unsigned has higher rank
Pitfall! This leads to
modular arithmetic
49. Integral promotion
• can cause surprising behavior. e.g.
uint8_t a = 1;
int b = ~a;
std::cout << std::hex << b << "n";
50. • can cause surprising behavior. e.g.
Integral promotion
uint8_t a = 1;
int b = ~a;
std::cout << std::hex << b << "n";
0xfffffffe
Promoted to int
zero-extended
bitwise inverted
52. unsigned promotion
• When wider than int, unsigned types are viral
• can cause surprising behavior if they sneak into
expressions.
53. unsigned promotion
• When wider than int, unsigned types are viral
• can cause surprising behavior if they sneak into
expressions. e.g.
int32_t a = -1;
uint32_t b = 1;
if (a > b) printf("wat");
54. unsigned promotion
int32_t a = -1;
uint32_t b = 1;
if (a > b) printf("wat");
wat
• When wider than int, unsigned types are viral
• can cause surprising behavior if they sneak into
expressions. e.g.
Promoted to unsigned
integer (0xffffffff)
55. Avoid implicit sign conversions
-Wsign-conversion -Werror
Integral promotion
56. • Pick signed/unsigned primarily
based on the arithmetic you want
• Signed integers ↔ arithmetic ops
• Unsigned integers ↔ bitwise ops
• Avoid signed → unsigned promotion
Summary
negative
& positive
only
positive
Normal
arithmetic
int
Modular
arithmetic
unsigned
int
Signed
integer
Unsigned
integer
Arithmetic
operators
Bitwise & shift
operators