为什么会出现无限循环?

时间:2019-09-08 19:37:24

标签: java

我需要通过手动计算(常数为 df <- structure(list(Location = c("L1", "L2", "L3", "L1", "L2", "L3" ), Day = c("05/13/2018", "05/13/2018", "05/13/2018", "05/14/2018", "05/14/2018", "05/14/2018"), `Lab Charge` = c(18, 12, 22, 14, 11, 11), `Elec Charge` = c(19, 14, 16, 20, 14, 14), `Mach Charge` = c(19, 22, 16, 15, 15, 15)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame")) df Location Day Lab Charge Elec Charge Mach Charge L1 05/13/2018 18 19 19 L2 05/13/2018 12 14 22 L3 05/13/2018 22 16 16 L1 05/14/2018 14 20 15 L2 05/14/2018 11 14 15 L3 05/14/2018 12 14 15 的EPSILON来计算输入数字的平方根。我的代码有什么问题?

(x2 - a) > EPSILON

1 个答案:

答案 0 :(得分:3)

您的循环正在迭代变量:xadeux,a和epsilon

您在循环内更改的参数是x

这就是循环无限的原因,因为(xadeux-a)> epsilon)始终保持不变