Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
测试用例 :
35000
-> 数字的标准化科学记数法是 3.5 * 10E4
-> 工程符号为 35 * 10E3
执行此操作的简单算法将继续将数字除以 10,直到我们获得所需的符号。然而,这意味着算法将是 O(零的数量)。我们能做得更好吗?
可以在此处阅读有关打印对人类友好的浮点数表示主题的经典论文。在此处的答案中将其作为代码讨论太复杂了。