{"id":2588,"date":"2013-11-10T00:01:00","date_gmt":"2013-11-10T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/11\/10\/weekend-scripter-powershell-does-scientific-notation\/"},"modified":"2013-11-10T00:01:00","modified_gmt":"2013-11-10T00:01:00","slug":"weekend-scripter-powershell-does-scientific-notation","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-powershell-does-scientific-notation\/","title":{"rendered":"Weekend Scripter: PowerShell Does Scientific Notation"},"content":{"rendered":"<p><strong>Summary<\/strong>: Microsoft PFE and guest blogger, Clint Huffman, talks about scientific notation and Windows PowerShell.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest blogger from the past&mdash;<a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/clint+huffman\/\" target=\"_blank\">Clint Huffman<\/a>. The keyboard is yours Clint&hellip;<\/p>\n<p>In Performance Monitor, if a number in a field is too large to display, scientific notation is used to represent the number. A value such as 30,064,771,072 (28 GB) is too large for a field to display, so it is represented as 3.0064e+010. This is not an error&mdash;it is scientific notation. It indicates that the decimal point must be moved to the right the number of times indicated after the plus (+) symbol. There are 9 digits behind a gigabyte, so the number 2.8637e+010 in the following image appears as a &ldquo;ball park&rdquo; figure of 28&nbsp;GB. But after dividing each thousands group by 1024, the true answer is 26.7&nbsp;GB.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7776.wes-11-10-13-1.png\"><img decoding=\"async\" title=\"Image of menu\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7776.wes-11-10-13-1.png\" alt=\"Image of menu\" \/><\/a><\/p>\n<p>Math is hard for me, and I avoid it when I can, so I use Windows PowerShell to help me with it. Windows PowerShell can convert values in gigabytes and return the number in bytes or vice-versa. For example, Windows PowerShell can convert 35GB into the full numeric value of 37580963840 in bytes.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0358.wes-11-10-13-2.png\"><img decoding=\"async\" title=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/0358.wes-11-10-13-2.png\" alt=\"Image of command output\" \/><\/a><\/p>\n<p>It can convert scientific notation into a full numeric value. For example, in the previous image, I typed the value 3.7580e+010 from Perfmon into Windows PowerShell and it returned 37580000000. Knowing what this number is in gigabytes would be nice, so I divided it by 1GB (Windows PowerShell understands KB as kilobytes, MB as megabytes, and so on) to give me the number in gigabytes. In this case, it didn&rsquo;t quite return an even 35&nbsp;GB because the actual number was truncated by Perfmon, but it is close enough.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2625.wes-11-10-13-3.png\"><img decoding=\"async\" title=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2625.wes-11-10-13-3.png\" alt=\"Image of command output\" \/><\/a><\/p>\n<p>The editor in me has to add this&hellip;<\/p>\n<p>Proper technical documentation is to use a space between the number and the unit, such as 10&nbsp;GB. The reason I specified 35GB earlier is because in order for Windows PowerShell to interpret the number as 35 gigabytes, the space must be removed between number and the unit&mdash;35&lt;space&gt;GB will throw an error.<\/p>\n<p>Enjoy!<\/p>\n<p>~Clint<\/p>\n<p>Cool. Thank you, Clint. I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><strong>Ed Wilson, Microsoft Scripting Guy<\/strong>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft PFE and guest blogger, Clint Huffman, talks about scientific notation and Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest blogger from the past&mdash;Clint Huffman. The keyboard is yours Clint&hellip; In Performance Monitor, if a number in a field is too large to display, scientific notation is used [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[76,56,164,3,4,61,45],"class_list":["post-2588","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-clint-huffman","tag-guest-blogger","tag-math","tag-scripting-guy","tag-scripting-techniques","tag-weekend-scripter","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft PFE and guest blogger, Clint Huffman, talks about scientific notation and Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest blogger from the past&mdash;Clint Huffman. The keyboard is yours Clint&hellip; In Performance Monitor, if a number in a field is too large to display, scientific notation is used [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=2588"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/2588\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=2588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=2588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=2588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}