From the course: Learning Julia

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Numbers in Julia

Numbers in Julia - Julia Tutorial

From the course: Learning Julia

Start my 1-month free trial

Numbers in Julia

- [Instructor] Okay, in this example we'll see how Julia works with different kinds of numbers. So, I'm going to open up numbers_start. So, Julia defines integer subtypes that have different byte sizes for both signed and unsigned integers. So, there's Int8, Int16, Int32 and so on. And there are unsigned versions of these as well. So, for example, I can specify that I want a 16-bit signed integer by making a variable. And I can say Int16 and then give it the value I want. In this case, I'll just use 1. And then if I print out the type of that variable. Or I can have Julia infer the type when I assign the value. So, for example, I can make a variable b and I can say it's an Int of 2000. And then I can do the same thing with the print line and the type of. So, Julia will assign an integer type based on whether the system you are working on is either 32 or 64-bits. Now, I could do the same thing with unsigned integers, which cannot be negative. It causes an error if you try it. So, I…

Contents