0

How do I get the initial value when a square rooted value is squared again in python?

For example :

np.square((np.sqrt(2)))

but the terminal gives the '2.0000000000000004'.

My opinion is about to square the value first, but can any correction be made in this code representation?

Kris
  • 518
  • 3
  • 13

1 Answers1

0
>>> round(np.square((np.sqrt(2))), 2)
2.0
Aaj Kaal
  • 1,205
  • 1
  • 9
  • 8
  • 3
    Hey, thanks for the answer! Could you give a bit of explanation? It would help OP and future readers :) – xShirase Oct 17 '20 at 23:47