How to calculate new “bits” value?

1

"Abby" wrote in message


I have an array which contain Hex no. in each position.

I would like to know what is the algorithm to do the 2's
complement for 8 bits checksum, and how can I write the code for it.

Two's complement is a way of representing negative numbers in binary.

Instead of having a bit which acts as a negative "flag", we invert, and then

increment.

So 1 is 0000 0001 int binary

inverting gives 1111 1110

incrementing gives 1111 1111 or -1 in two's complement.

The nice thing is that by adding, and discarding the overflow, we get the
correct answer.

0000 0001 = 1
+1111 1111 = -1
=1 0000 0000

discard the overflow and we get 1 + -1 = 0;

A checksum is a technique to check data for transmission errors or
tampering. If the last few bytes are the sum of all the preceding bytes,
then any errors are likely to be detected.

The problem is that "two's...

0 0
2

Incredible product, even better tech support…AbleBits totally delivers!

Anyone who works with Excel is sure to find their work made easier

The best spent money on software I've ever spent!

Ablebits is a fantastic product - easy to use and so efficient.

I don't know how to thank you enough for your Excel add-ins

Anybody who experiences it, is bound to love it!

AbleBits suite has really helped me when I was in a crunch!

I have enjoyed every bit of it and time am using it

It's the best $100 we've ever spent!

I love the program, and I can't imagine using Excel without it!

It is like having an expert at my shoulder helping me…

Your software really helps make my job easier

Thanks for a terrific product that is worth every single...

0 0
3

Jeff Sauro • September 15, 2015

Customer lifetime value (CLV) may sound like something only accountants care about.

But there are good reasons researchers and designers should have some idea about the monetary value of a customer.

Measuring ROI: If your efforts lead to improving the user experience and that translates into retaining more existing customers or gaining new customers, knowing the lifetime value of a customer is a solid way to justify your efforts as a return on investment (ROI).

Prioritizing design improvement: There's always a limited amount of resources and too many features to fix or add. While designers and developers don't need to know how to calculate every customer or account metric, understanding the value of a customer helps with making more intelligent prioritization of features. If you know that a feature is less used it might not make it into the next release. If, however, that feature is popular with more profitable and loyal...

0 0
4

Hi NTMS,

In the attachment I see that you are on the right way. But let me explain it for all visitors.

Have a look to table 7 and 8 (I refer to the MIFARE Classic data sheet with the link above). You can see in table 7, with none combination of C1, C2 and C3 you can read the key A, so key A is a write-only value. C1 = 0, C2 = 0 and C3 = 1 is the so called “transport condition” for the sector trailer. With the known value of default key A = FF…FF you authenticate with key A to the sector and you are able to read the access condition (ac) bytes, the key B. You are also able to write to key A, the ac bytes, key B. Table 8 shows the ac bytes for the data blocks 0, 1 and 2. Here is the transport condition C1 = C2 = C3 = 0. This means, you can read, write, increment, decrement all data blocks either with key A or key B.

You want to use key A for reading and key B for writing. This is the setting for the data blocks. In this case key A is known at the reader...

0 0
5
Notes:

The value of K (Kilo) during calculations can take two values 1024 or 1000, depends on which type of calculation you want to perform. Consider using K = 1024 when you are considering storage capacity whether in hard disk, DVDs, flash drives or other devices and storage media. K = 1000 should be used when you are thinking of throughput, ie the speed at which information is transferred.

Example: If your computer has 1 KB of disk space is says that he has 1024 B of space, now the throughput of your network card is 1 KB/s then it is said that it transmits data to 1000 B/s.

Usage: Enter the value and unit and click convert, the calculator will perform the conversion to all units.

Download this game to enjoy during your free time! (Google...

0 0
6
Old Definitions:
1 kb = (210) bits = 1 024 b
1 MB = (210)2 Bytes = 1 048 576 B

To make the SI prefixes universal and to avoid confusion in the future, International Electrotechnical Commission (IEC), the leading international organization for worldwide standardization in electrotechnology, approved in December 1998 standard names and symbols of prefixes for binary multiples to be used in the fields of data processing and transmission. The prefixes are:



It is suggested that in English, the first syllable of the name of the binary-multiple prefix should be pronounced in the same way as the first syllable of the name of the corresponding SI prefix, and that the second syllable should be pronounced as "bee." Examples and comparisons with SI prefixes:
1 Kib = 210 bit = 1024 bit,
1 kb = 103 bit = 1000 bit,
1 MiB = 220 B = 1 048 576 B,
1 MB = 106 B = 1 000 000 B,
1 GiB = 230 B = 1 073 741 824 B,
1 GB = 109 B = 1 000 000 000 B.
...
0 0
7
...
0 0
8

I do currently have a similar issue, but I do not only need the scale, but also need the mantisse as integer. Based on the solutions above, please find the fastest, I could come up with, below. Statistics: "ViaBits" takes 2,000ms for 7,000,000 checks on my machine. "ViaString" takes 4,000ms for the same task.

public class DecimalInfo { public BigInteger Mantisse { get; private set; } public SByte Scale { get; private set; } private DecimalInfo() { } public static DecimalInfo Get(decimal d) { //ViaBits is faster than ViaString. return ViaBits(d); } public static DecimalInfo ViaBits(decimal d) { //This is the fastest, I can come up with. //Tested against the solutions from http://stackoverflow.com/questions/763942/calculate-system-decimal-precision-and-scale if (d == 0) { return new DecimalInfo() { Mantisse = 0, Scale = 0, }; } else { byte scale = (byte)((Decimal.GetBits(d)[3] >> 16) & 31); ...
0 0
9

I'm recording mic input using the XNA library (I don't think this is really technology specific, but it never hurts). Every time I get a sample I would like to calculate the decibels. I have done many searches on the internet and not found a rock solid example...

Here is my attempt at calculating decibels from a sample:

double peak = 0; for (var i = 0; i < _buffer.Length; i = i + 2) { var sample = BitConverter.ToInt16(_buffer, i); if (sample > peak) peak = sample; else if (sample < -peak) peak = -sample; } var decibel = (20 * Math.Log10(peak/32768));

If I output the decibel value to the screen I can see the values get higher as I get louder and lower as I speak softer. However, it always hovers around -40 when I'm absolutely quiet...I would assume it would be -90. I must have a calculation wrong in the block above?? from what I have read on some sites -40 is equivalent to "soft talking"...however, it's totally...

0 0
10
...
0 0
11

A basis point is one-hundredth of a percentage point. That is, 100 basis points = 1 percent, theoretically of any measured quantity....

Basis points are used for both Treasury bonds and municipal bonds. ... Calculator; Show More. Instructions. 1. Subtract the lower basis point...

Calculating basis points can be complicated, but it helps to first understand the definition of a basis point. Find out how basis...

DV01 sounds like the name of a drone aboard a spaceship, but it stands for the "dollar value of 1 basis point."...

How to Calculate Basis Points. In many businesses, particularly within the mortgage industry, basis points, also referred to as BPS (basis point...

Communication between computers occurs at varying speeds --- measured in bits per second (bps) --- depending on the networking hardware's capabilities. File...

How to Calculate Mortgage Basis Points. What Are Points Regarding a Home Loan? How to Calculate...

0 0
12

Calculating the Netmask Length (also called a prefix):

Convert the dotted-decimal representation of the netmask to binary. Then, count the number of contiguous 1 bits, starting at the most significant bit in the first octet (i.e. the left-hand-side of the binary number).

255.255.248.0 in binary: 11111111 11111111 11111000 00000000 ----------------------------------- I counted twenty-one 1s -------> /21

The prefix of 128.42.5.4 with a 255.255.248.0 netmask is /21.

Calculating the Network Address:

The network address is the logical AND of the respective bits in the binary representation of the IP address and network mask. Align the bits in both addresses, and perform a logical AND on each pair of the respective bits. Then convert the individual octets of the result back to decimal.

Logical AND truth table:

128.42.5.4 in binary: 10000000 00101010 00000101 00000100 255.255.248.0 in binary: 11111111...
0 0
13
...
0 0