 Hello everyone, it is CryptoGround here and welcome back to another Unity idle game tutorial video. This is episode 5.2 And today we're gonna be implementing the scientific notation. It's been about a month since I've last posted I'm deeply sorry for that. I've been very busy with Compacto and just a bunch of other stuff So I'm gonna do my best to get back into a better routine I guess but yeah So if you find this video helpful make sure you leave a like subscribe for your new round here and turn on notifications for Future videos and live streams. Let's get right into it. First thing you want to do is open up your methods script because we're gonna be messing with our Notation method. So if you don't remember from the last episode, we have implemented the standard notation inside of our notation switcher here and This one's gonna be very easy actually. So I'll show you why so this is so easy to do because a big double Contains two fields a mantissa and an exponent So the mantissa is basically what we have before the decimal and that's what we do inside of our standard notation And the exponent is the exponent, right? Let me provide you guys an example of what the scientific notation really is. So let's say we have a number Let's just do Something like this 1.345 million. So let's start with the exponent So the exponent is how many digits this is or we can just take the log 10 of this number and We will get the exponents. So basically log 10 of this number is going to be 6.128 and 7 so we want to round this down and that will be our exponent So we do that by flooring it so this rounds our number down and basically this just we have our six as our exponent Now for our mantissa, we want to take the first I don't know three or four digits of this number and we already have that so we get that from the mantissa variable Which is part of the big double So our mantissa in this situation will be 1.345 And we can just keep going on if we want so this would be the mantissa of this number But we want to simplify it down to Three or two decimal places And that would be rounded up like that. So first let's grab this mantissa from this This input here our input number. So to do that. We just access the mantissa Field from number and we're going to convert it to a string and we're going to apply our Fixed point Format and let's just show three decimals. You can do two you can do three Whatever you want if you would like to add some customization We can also add another parameter inside of this method for our Mantissa digits and by default I want to show three So now we need to apply this variable to both of our formats So I'm going to add a dollar sign and add curly braces and then our Our variable here and this is string interpolation. We're gonna do the same thing with this one All right, so next we want to add the E, but I want to Converts the string interpolation just so this makes it look a lot cleaner All right, and then I'm going to add E and then our exponents. So this will be number dot exponent All right, so now for the exponent when it gets bigger I want to show commas just because it looks nicer. So what we're gonna do is apply the number Format so n and we don't want any decimal. So zero so n zero So now we're gonna see some commas when we have bigger numbers All right, that's all we need to do in here. So let's head to our game and play it sweet So this is what it looks like. It's a bit messy. Let me get rid of some of these There we go. Okay, so yeah, this is what it looks like That's how I want it to be and make sure you are in the scientific notation and settings if you just want to see it Otherwise it'll look like this will be standard. So yeah, make sure you switch it in the settings And you will see the correct results Now the one issue I see is that our cost down here I don't see this decimal effect working. Let's take a look. All right So inside of our upgrades manager, I realize that I haven't applied the notation to our upgrade costs yet So all you need to do is dot notate and if you want to apply a certain amount of decimal So let's say we want two decimals We can just put two so our normal digits that would be this we only want two and For our Mantissa here, let's say we only want one You know, we can just put one in here if you want to you can put two if you want five you can put five Whatever you want so you can mess with these settings all you want Otherwise if you just put in two by default the mantissa digits will be three So I want to leave this as normal so just be dot notate and we will get three normal digits and We will have three mantissa digits. That makes sense. Okay, sweet So as you can see we have three normal digits and when we get to the higher numbers You can see we have three mantissa digits like that Cool. All right, so that is all we need to do for this video if you enjoyed this one and if it was helpful Make sure you leave a like subscribe if you're new Subscribe to my channel for your new round here and turn on that bell for future notifications for videos and live streams All right guys, I'll see you in episode 5.3, which would be the engineering notation So it's very similar to Scientific except we will see more numbers. It's more like a mix of standard and scientific Have a good rest of your day or night and thank you guys for watching. I'll catch you guys in the next one. Peace