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

      • <bdo id='nNqAT'></bdo><ul id='nNqAT'></ul>
      <legend id='nNqAT'><style id='nNqAT'><dir id='nNqAT'><q id='nNqAT'></q></dir></style></legend>

      <tfoot id='nNqAT'></tfoot>

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

        为什么取幂从右到左?

        Why is exponentiation applied right to left?(为什么取幂从右到左?)
        • <i id='N9NoO'><tr id='N9NoO'><dt id='N9NoO'><q id='N9NoO'><span id='N9NoO'><b id='N9NoO'><form id='N9NoO'><ins id='N9NoO'></ins><ul id='N9NoO'></ul><sub id='N9NoO'></sub></form><legend id='N9NoO'></legend><bdo id='N9NoO'><pre id='N9NoO'><center id='N9NoO'></center></pre></bdo></b><th id='N9NoO'></th></span></q></dt></tr></i><div id='N9NoO'><tfoot id='N9NoO'></tfoot><dl id='N9NoO'><fieldset id='N9NoO'></fieldset></dl></div>

              <tbody id='N9NoO'></tbody>

            <tfoot id='N9NoO'></tfoot>

                  <bdo id='N9NoO'></bdo><ul id='N9NoO'></ul>
                  <legend id='N9NoO'><style id='N9NoO'><dir id='N9NoO'><q id='N9NoO'></q></dir></style></legend>
                • <small id='N9NoO'></small><noframes id='N9NoO'>

                  本文介绍了为什么取幂从右到左?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在阅读 Python 简介教科书并遇到了这一行:

                  I am reading an Intro to Python textbook and came across this line:

                  同一行上的运算符具有相同的优先级,并且从左到右应用,但取幂除外,它从右到左应用.

                  Operators on the same row have equal precedence and are applied left to right, except for exponentiation, which is applied right to left.

                  我了解其中的大部分内容,但我不明白为什么他们说取幂是从右到左应用的.他们也没有提供任何示例.另外,我可以问这样的一般性问题,还是只喜欢解决问题的问题?

                  I understand most of this, but I do not understand why they say exponentiation is applied right to left. They do not provide any examples either. Also, am I allowed to ask general questions like this, or are only problem solving questions preferred?

                  推荐答案

                  ** 运算符遵循 正常的数学约定;它是右结合的:

                  The ** operator follows normal mathematical conventions; it is right-associative:

                  在通常的计算机科学术语中,数学中的取幂是右结合的,这意味着 xyz 应该读作 x(yz),而不是 (xy)z.在对 BODMAS 规则的阐述中,对这个问题的处理非常谨慎,规则是首先评估最高指数.

                  In the usual computer science jargon, exponentiation in mathematics is right-associative, which means that xyz should be read as x(yz), not (xy)z. In expositions of the BODMAS rules that are careful enough to address this question, the rule is to evaluate the top exponent first.

                  来自维基百科关于操作顺序:

                  如果用堆叠符号表示求幂,通常的规则是从上到下工作,因为求幂在数学中是右结合的.

                  If exponentiation is indicated by stacked symbols, the usual rule is to work from the top down, because exponention is right-associative in mathematics.

                  所以 2 ** 3 ** 4 计算为 2 ** (3 ** 4) (== 2417851639229258349412352) 而不是 (2 **3) ** 4 (== 4096).

                  So 2 ** 3 ** 4 is calculated as 2 ** (3 ** 4) (== 2417851639229258349412352) not (2 ** 3) ** 4 (== 4096).

                  这在编程语言中非常普遍;它被称为右关联性,尽管个例外,其中 Excel 和 MATLAB 是最值得注意的.

                  This is pretty universal across programming languages; it is called right-associativity, although there are exceptions, with Excel and MATLAB being the most notable.

                  这篇关于为什么取幂从右到左?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)
                • <tfoot id='mggkT'></tfoot>

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

                      <bdo id='mggkT'></bdo><ul id='mggkT'></ul>
                        <tbody id='mggkT'></tbody>

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

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