Это видео недоступно.
Сожалеем об этом.
JavaScript Tip: Avoiding Problems with Decimal Math
HTML-код
- Опубликовано: 14 авг 2024
- Though not an exciting topic, dealing with decimal math in javascript is an important topic. Because of the way JavaScript stores numbers, it may provide inaccurate results when doing math on decimals. In this tutorial I will show you to solutions.
Would you like to help keep this channel going?
/ allthingsjavascript
For more resources on JavaScript:
www.allthingsja...
Courses offered on Udemy: Getting Started or Advanced Topics at a huge discount:
www.udemy.com/...
www.udemy.com/...
New Mastering Regular Expressions in JavaScript:
www.udemy.com/...
Tutorials referred to in this video:
JavaScript Objects Playlist: • JavaScript Objects
#javascript #AllThingsJavaScriptLLC
Wow Sir , please never stop doing this vídeos. I love to learn something new every time
Thank you sir! It's very slow paced so it helps me understand better!
Really thank you sir! I was going to get crazy with numbers
With voice of yours, everything you say I believe!
I love your videos!! Thank you so much always for this amazing video!
Awesome tutorial!!
How about new Big(3).div(new Big(10.2)).times(new Big(10.2)) ? it suppose to give new 3 but gives less than or greater than 2 depends on DP , RM configuration.
Rounding mode ==== 2 (ROUND_CEIL)
This always rounds up unless it's infinite string of zeros
i got this question during interview in reputable logistic chain company
Very Helpful Thank you very much!
Thank you sir for the educative video. Can't we just use .toFixed(2) to get the correct result instead of using a library? For example, (0.1+0.2).toFixed(2) gives us 0.30
That would work for that specific situation. This is just an example of issues you could run into.
@@AllThingsJavaScript On which scenario wouldn't it work?
@@abdimussa8932 Here is a pretty good article that goes into more detail: www.progress.com/blogs/limitations-number-type-javascript
Really thanks
Thanks
Javascript is drunk! It needs to sniff some cocaine to sober up!
Could you please suggest some libraries for Dates? because i find Dates frustrating in javascript
Here are a few tutorials I've done on dates: ruclips.net/video/j8katkbMVhs/видео.html and ruclips.net/video/uWQEGgNvac0/видео.html I haven't used a library for dates, but did a quick look and this one looks pretty decent: momentjs.com/
love this videos, waiting for nodeJs.
Here is the playlist with the current tutorials I've done on node. ruclips.net/p/PLTo9PCskHpbHOCWbxxukNU8sp57tPy4Qh
@@AllThingsJavaScript Thanks for your reply. I done all these.
@@seenuvasanv Sounds good. I have more planned, but the vanilla javascript is most popular, so I've focused on those.
thanks,👍 good topic, speed up plz.
حمیدرضا خان، این یه ویدئو آموزش برنامه نویسیه، مسابقه فوتبال نیستش که سرعت لازم داشته باشه! برای یادگیری باید صبور بود، و حوصله ای که ایشون از خودش نشون میده بسیار خوب و قابل ستایسشه، و بیننده هم باید شکیبا باشه تا چیز یاد بگیره
80.1 * 100 = 8009.999999999999
Using Dec.mul(Dec('80.10'),Dec('100')) from decimal.js returns 8,010
First input: Dec = Decimal.clone({precision:5,toExpPos:+10,toExpNeg:-5,rounding:8}) Dec.divide(Dec('1E+13'),Dec('32')).toString(), Returned output: '3.12e+13'
Second input: Dec = Decimal.clone({precision:5,toExpPos:+10,toExpNeg:-5,rounding:8})
Dec.divide(Dec('-1E+13'),Dec('32')).toString(), Returned output: '-3.13e+13'
Thank you sir! It's very slow paced so it helps me understand better!
Glad it helped!