Computer Science: The Magic of Two's Complement Binary Math

Support this channel and learn something new; buy my C++ Best Practices Book!


What is GEEK

Buddha Community

Computer Science: The Magic of Two's Complement Binary Math
Uriah  Dietrich

Uriah Dietrich


How To Build A Data Science Career In 2021

For this week’s data science career interview, we got in touch with Dr Suman Sanyal, Associate Professor of Computer Science and Engineering at NIIT University. In this interview, Dr Sanyal shares his insights on how universities can contribute to this highly promising sector and what aspirants can do to build a successful data science career.

With industry-linkage, technology and research-driven seamless education, NIIT University has been recognised for addressing the growing demand for data science experts worldwide with its industry-ready courses. The university has recently introduced B.Tech in Data Science course, which aims to deploy data sets models to solve real-world problems. The programme provides industry-academic synergy for the students to establish careers in data science, artificial intelligence and machine learning.

“Students with skills that are aligned to new-age technology will be of huge value. The industry today wants young, ambitious students who have the know-how on how to get things done,” Sanyal said.

#careers # #data science aspirant #data science career #data science career intervie #data science education #data science education marke #data science jobs #niit university data science

77 Programming Language Q&A (P4)

The following article deals with questions/answers you may encounter when asked about Lexical and Syntax Analysis. Check the bottom of the page for links to the other questions and answers I’ve come up with to make you a great Computer Scientist (when it comes to Programming Languages).

324. What are the 3 approaches to implementing programming languages?

  • Compilation, Pure Interpretation and Hybrid Implementation

325. What is the job of the syntax analyzer?

  • Check the syntax of the program and create a parse tree.

326. What are the syntax analyzers based on?

  • Formal description of the syntax of programs, usually BNF.

327. What are some of the advantages of using BNF?

  • Descriptions are clear and concise.

  • Syntax analyzers can be generated directly from BNF.

  • Implementations based on BNF are easy to maintain.

328. What are the 2 distinct parts of syntax analysis and what do they do?

  • Lexical analysis: deals with small-scale language constructs such as name

  • Syntax analyzer: deals with large-scale constructs such as expressions

329. What are the 3 reasons for why lexical analysis is separated from syntax analysis?

  • Simplicity, Efficiency and Portability

330. What does the lexical analyzer do?

  • Collects input characters into groups (lexemes) and assigns an internal code (token) to each group.

331. How are lexemes recognized?

  • By matching the input against patterns.

#programming #programming-languages #computer-science-theory #computer-science #computer-science-student #data science

Sasha  Lee

Sasha Lee


From Science to Data Science

  1. Introduction and Hypothesis

I loved to work as a scientist. There is a deep feeling of completion and happiness when you manage to answer why. Finding out why such animal would go there, why would they do this at that time of the year, why is that place so diverse… This applies to any kind of field. This is the reason why I want to advocate that if you are a scientist, you might want to have a look at what is called Data Science in the technological field. Be aware, I will not dwell in the details of titles such as Data engineer, data analyst, data scientist, AI researcher. Here, when I refer to Data Science, I mean the science of finding insights from data collected about a subject.

So, back to our **_why. _**In science, in order to answer your why, you will introduce the whole context surrounding it and then formulate an hypothesis. “The timing of the diapause in copepods is regulated through their respiration, ammonia excretion and water column temperature”. Behaviour of subject is the result of internal and external processes.

In marketing, you would have to formulate similar hypothesis in order to start your investigation: “3-days old users un-suscribes due to the lack of direct path towards the check-out”. Behaviour of subject is the result of internal (frustration) and external (not optimized UE/UI) processes.

Although I would have wanted to put that part at the end, as for any scientific paper, it goes without saying that your introduction would present the current ideas, results, and hypotheses of your field of research. So, as a researcher, you need to accumulate knowledge about your subject, and you go looking for scientific articles. The same is true for techs as well. There are plenty of scientific and non-scientific resources out-there that will allow you to better understand, interpret and improve your product. Take this article, for instance, Medium is a wonderful base of knowledge on so many topics! But you could also find passionating articles on PloS One on Users Experience or Marketing Design and etc.

2. Material and Methods

As a Marine biologist and later an Oceanographer, I took great pleasure to go at the field and collect data (platyhelminths, fish counts, zooplankton , etc…). Then we needed to translate the living “data” into numeric data. In the technological industry, it is the same idea. Instead of nets, quadrats, and terrain coverage, you will setup tracking event, collect postbacks from your partners and pull third-parties data. The idea is the same, “how do I get the information that will help me answer my why”. So a field sampling mission and a data collection planning have a lot in common.

#ai #data-science #science #tech #data science #from science

Computer Science: The Magic of Two's Complement Binary Math

Support this channel and learn something new; buy my C++ Best Practices Book!


A crash course on integers in two’s complement in a computer

Negative integers, like −108 and −32768, have always presented a bit of a conceptual hurdle to humans, from our distant ancestors who didn’t quite know what to make of them, to students today trying to make sense of how integers are represented by computers.

For this article, I assume that you know the basics of integer arithmetic (adding and multiplying) and that you know the basics of the binary representation of zero and positive integers.

In a computer, the “primitive” integer data types are of fixed width, like for example, eight bits, which make up a byte. So, an unsigned byte can represent any integer from 0 (as 0000 0000; the space is just for our convenience for quick reading) to 255 (as 1111 1111).

Just like in decimal the decimal digits multiply powers of 10 sequentially, so in binary the bits multiply powers of 2 sequentially. So 255 as 1111 1111 is 2⁷ + 2⁶ + 2⁵ + 2⁴ + 2³ + 2² + 2¹ + 2⁰ (remember that _x_⁰ = 1 always).

Thus eight bits can represent 2⁸ = 256 distinct integers. But how do we represent a negative integer like −47 in eight bits?

In our notation, we use the minus sign as a prefix. In a monospace font, we almost always use the dash, since it’s practically indistinguishable from the proper minus sign.

Sometimes, for clarity, we use the plus sign as a prefix for positive numbers. But since it’s considered the default, it’s usually omitted. The minus sign, or its substitute, must be used for a negative number.

But on a computer chip, there’s no separate symbol that can be used as a minus sign, it’s all 0s and 1s.

I don’t know who came up with the idea of the sign bit. It’s a simple enough idea: you take the leftmost bit and use it as a Boolean flag for whether or not the number is negative.

So 47 in a signed byte would be 0010 1111, just like in an unsigned byte, and −47 would be 1010 1111. Easy enough.

There are a couple of problems with this, though. First, this gives us two different representations for 0: the obvious one as 0000 0000, and the “negative zero” 1000 0000.

Widening conversions are not consistent. To widen a signed byte to a signed 16-bit “word,” we couldn’t just copy the bit pattern and fill in the extra bits, we’d have to potentially change the original bit pattern.

For example, 0010 1111 would be widened to 0000 0000 0010 1111, which leaves the original bit pattern unchanged, but 1010 1111 would be widened to 1000 0000 0010 1111, which changes the leftmost bit of the original bit pattern.

Widening conversions for unsigned integers would then be different from widening conversions for signed integers. Narrowing conversions are similarly problematic.

#twos-complement #integer #computer-science #data-science