• <legend id='FzVlo'><style id='FzVlo'><dir id='FzVlo'><q id='FzVlo'></q></dir></style></legend>

  • <tfoot id='FzVlo'></tfoot>

        <small id='FzVlo'></small><noframes id='FzVlo'>

        <i id='FzVlo'><tr id='FzVlo'><dt id='FzVlo'><q id='FzVlo'><span id='FzVlo'><b id='FzVlo'><form id='FzVlo'><ins id='FzVlo'></ins><ul id='FzVlo'></ul><sub id='FzVlo'></sub></form><legend id='FzVlo'></legend><bdo id='FzVlo'><pre id='FzVlo'><center id='FzVlo'></center></pre></bdo></b><th id='FzVlo'></th></span></q></dt></tr></i><div id='FzVlo'><tfoot id='FzVlo'></tfoot><dl id='FzVlo'><fieldset id='FzVlo'></fieldset></dl></div>

          <bdo id='FzVlo'></bdo><ul id='FzVlo'></ul>

        java中如何用科学计数法表示数字?

        How to express numbers in scientific notation in java?(java中如何用科学计数法表示数字?)
          <bdo id='iqvlU'></bdo><ul id='iqvlU'></ul>

            <tbody id='iqvlU'></tbody>
            <legend id='iqvlU'><style id='iqvlU'><dir id='iqvlU'><q id='iqvlU'></q></dir></style></legend>
          • <small id='iqvlU'></small><noframes id='iqvlU'>

            <i id='iqvlU'><tr id='iqvlU'><dt id='iqvlU'><q id='iqvlU'><span id='iqvlU'><b id='iqvlU'><form id='iqvlU'><ins id='iqvlU'></ins><ul id='iqvlU'></ul><sub id='iqvlU'></sub></form><legend id='iqvlU'></legend><bdo id='iqvlU'><pre id='iqvlU'><center id='iqvlU'></center></pre></bdo></b><th id='iqvlU'></th></span></q></dt></tr></i><div id='iqvlU'><tfoot id='iqvlU'></tfoot><dl id='iqvlU'><fieldset id='iqvlU'></fieldset></dl></div>

                • <tfoot id='iqvlU'></tfoot>
                  本文介绍了java中如何用科学计数法表示数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一个处理行星质量和直径的程序;这些量以科学计数法表示.我的问题不是,请注意,不是如何以正确的方式打印大数字(那是使用 printf(),duh),我会如何...输入"这些数字,我猜你可以说.例如,汞的质量表示为:

                  I'm writing a program that deals with planets' mass and diameter; These quantities are expressed in scientific notation. My question is NOT, mind you, NOT how does one print large numbers the right way (That's using printf(), duh), its how I would... "type" these numbers, I guess you could say. For example, the mass of mercury is expressed:

                  3.30 x 1023
                  

                  在我的行星质量数组中,一个元素看起来是:

                  And in my array of planet masses, an element would look:

                  33.0 * Math.pow(10, 23)
                  

                  但是,我不认为这是正确的方法——它看起来会引发异常......那么从程序员的角度来看,我如何表达这样的大数字呢?谢谢!

                  However, I don't quite think this is the right way - it looks like it would throw an exception... So how could I express large numbers like that from a programmer's perspective? Thanks!

                  推荐答案

                  JLS 的第 3.10.2 节 讨论了 Java 中的浮点文字.简而言之,提供小数部分就好像它是科学记数法一样,但您应该写 e23:

                  Section 3.10.2 of the JLS talks about floating-point literals in Java. In short, provide the decimal part as if it were scientific notation, but instead of x 10^23 you would write e23:

                  3.30e23
                  

                  要写一个负指数,您也可以轻松地为 6.67 x 10^(-11):

                  To write one with a negative exponent, you can do that easily also for 6.67 x 10^(-11):

                  6.67e11
                  

                  这篇关于java中如何用科学计数法表示数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                • <i id='5g1rN'><tr id='5g1rN'><dt id='5g1rN'><q id='5g1rN'><span id='5g1rN'><b id='5g1rN'><form id='5g1rN'><ins id='5g1rN'></ins><ul id='5g1rN'></ul><sub id='5g1rN'></sub></form><legend id='5g1rN'></legend><bdo id='5g1rN'><pre id='5g1rN'><center id='5g1rN'></center></pre></bdo></b><th id='5g1rN'></th></span></q></dt></tr></i><div id='5g1rN'><tfoot id='5g1rN'></tfoot><dl id='5g1rN'><fieldset id='5g1rN'></fieldset></dl></div>
                    <tbody id='5g1rN'></tbody>
                    <legend id='5g1rN'><style id='5g1rN'><dir id='5g1rN'><q id='5g1rN'></q></dir></style></legend>
                    <tfoot id='5g1rN'></tfoot>

                        <bdo id='5g1rN'></bdo><ul id='5g1rN'></ul>

                        <small id='5g1rN'></small><noframes id='5g1rN'>