在Xcode中添加大功率值 [英] Adding large Power values in Xcode

查看:103
本文介绍了在Xcode中添加大功率值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Objective C和iPhone开发的新手。

I am new to Objective C and iPhone development.

我正在使用基本计算器。我想在文本字段中添加一个大值。如何在Xcode中显示如下的大值:6.67543 x 10 ^ -34?
谢谢

I'm working with a basic calculator. I want to add a large value in text field. How can I display large values like this : 6.67543 x 10^ -34 in Xcode? Thank you

推荐答案

您可以使用NSNumberFormatterScientificStyle设置NSNumberFormatter并调用stringFromNumber ...但是,问题我我们希望支持的精确度需要一个专门的框架。可能有一个基于GNU MP Bignum库,但我不知道它。

You could set up a NSNumberFormatter with NSNumberFormatterScientificStyle and call stringFromNumber... However, the issue I think is going to be with the precision you are hoping to support requires a specialized framework. There might be one based on GNU MP Bignum library out there, but I don't know it off hand.

这篇关于在Xcode中添加大功率值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆