菜鸟教程小白 发表于 2022-12-13 09:50:58

ios - 比无符号长大


                                            <p>我正在开发一个iOS Objective C应用程序,您在其中积累了大量的财富。到应用程序结束时,用户可以累积的资金超过了长期所需。我应该使用哪种数据类型呢?我知道我可以使用无符号长整数,但这只会增加一点点。我需要用户再加上6个数字来确保安全,因此与其最大值(18,446,744,073,709,551,615(约1.8x10 ^ 19))不同,不如将其最大值设为1.8x10 ^ 25(而不是最大值)。<br><br>最终,精确度实际上并不是那么重要,但是它可以节省我很多时间,而不必改变整个应用程序中的数据类型。有任何想法吗?</p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><strong>简短答案</strong><br>前往第三方图书馆。<br><br> <strong>详细答案</strong><br>在处理大量数字时,最基本的设计决策之一可能是如何代表大量数字?<br><br>它是字符串,数组,列表还是自定义(本地)存储类。<br><br>做出决定后,可以将实际的数学运算分解成较小的部分,然后使用本地语言类型(例如int或integer)执行。<br><br>即使使用字符串,字符数或数字中的“数字”也有限制,如下所示:<br><br> <a href="https://stackoverflow.com/questions/140468/what-is-the-maximum-possible-length-of-a-net-string" rel="noreferrer noopener nofollow">What is the maximum possible length of a .NET string?</a><br><br>您可能还需要检查:<a href="https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic" rel="noreferrer noopener nofollow" title="Arbitrary-precision arithmetic">Arbitrary description Arithmetic </a></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 比无符号长大,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/31978360/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/31978360/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 比无符号长大