如何确定数字是浮点数还是双数? [英] How To determine whether the number is float or double?

查看:72
本文介绍了如何确定数字是浮点数还是双数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有一个实数...我们知道它的定义是什么......我们怎样才能确定它是浮点数还是双数?

Suppose we have a real number...We dnt know what it was defined...How can we determine that it is float or double?

推荐答案

我们在哪里?在字符串中?

提供更多详细信息,并解释您尝试过的内容或您的想法。
Where do we have it? In a String?
Give more details and also explain what you have tried or what your ideas are about it.


它不是一个字符串,它是一个实数(已经提到了)..


关于想法---我从一个函数接收一个实数。我需要打印收到的号码是浮点还是双倍?我们可以通过将它存储在float中来确定并查看不兼容类型的编译器错误,但是我必须在程序中打印它?我知道返回类型,但知道它是一个返回的实数....
Its not a String its a real number(already mentioned)..

Regarding idea --- I am receiving a real number from a function. I need to print what the received number is float or double ? We can determine by storing it in float and see the compiler error of incompatible types but I have to print that in a program? I dnt kw about the return type but know that it is a real number that is being returned....


@ puneetsardana88


这是一个愚蠢的要求;如果一个方法返回一个double并且你试图在float变量中接收它,那么编译器就会抱怨。反过来也是愚蠢的(编译器不会抱怨),因为你可以知道方法的返回类型。整个练习都很愚蠢,不值得讨论。


亲切的问候,


Jos
@puneetsardana88
That is a silly requirement; if a method returns a double and you try to receive it in a float variable the compiler would complain. The other way around is silly as well (the compiler won''t complaint) because you can know the return type of the method. The entire exercise is just silly and not worth this discussion.

kind regards,

Jos


这篇关于如何确定数字是浮点数还是双数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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