मराठी

If 2 = 1.414, and the square_root() function returns -1.414, does it violate the following specification? -- square_root (x) -- inputs: x is a real number , x ≥ 0 -- outputs: y is a real number

Advertisements

प्रश्न

If `sqrt2` = 1.414, and the square_root() function returns -1.414, does it violate the following specification?

-- square_root (x)
-- inputs: x is a real number , x ≥ 0
-- outputs: y is a real number such that y2 = x

एका वाक्यात उत्तर
Advertisements

उत्तर

No, because (- 1.414)2 = 2, which satisfies input – output relation (y2 = x)

shaalaa.com
Algorithmic Problems
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Specification and Abstraction - Evaluation - Section - B [पृष्ठ ८६]
Advertisements
Share
Notifications



      Forgot password?
Use app×