作业帮 > 数学 > 作业

英语翻译6.Since you cannot take the square root of anegative num

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/05/08 03:57:44
英语翻译
6.Since you cannot take the square root of anegative number,you might use which of the following instructions to find thesquare root of the variable
a) Math.sqrt(x*x);
b) Math.sqrt((int) x);
c) Math.sqrt(Math.abs(x));
d) Math.abs(Math.sqrt(x));
选c,题目说如果对一个数求平方根的话,但是这个数有可能是负数,那么如下哪种方式可以保证结果正确
Math.abs是去取绝对值的,所以可以保证