-->
当前位置:首页 > 题库

PROGRAMMING:Introduction to jmu-java-01 - open root

Luz5年前 (2021-05-10)题库418
The root of a given value x is obtained by using the step-by-step approximation method.
**Step by step approximation method description * *: from 0 step by step accumulation step value.
Step size = 0.0001, epsilon (error) = 0.0001
**Conditions for the cycle to continue:**
`Square value < x 'and' | x-square value | > epsilon`
###Description and reference
1. Keep 6 decimal places for numerical output, and use system. Out. Printf ("%. 6F / N")
2. Square, refer to math.pow function.
3. When the input value is less than 0, return * * double.nan**
###Input format:
Arbitrary value
###Output format:
For each group of inputs, output its open root in one line. Keep 6 decimal places
###Input example:
```in
-1
0
zero point five
zero point three six
one
six
one hundred
one hundred and thirty-one
```
###Output example:
```out
NaN
zero
zero point seven zero seven one zero zero
zero point six zero zero zero zero zero
one
two point four four nine five zero zero
ten
eleven point four four five six zero zero
```






answer:If there is no answer, please comment