From 720f7c8b8059a1a5ce1d10f3c26554d60bad2aa7 Mon Sep 17 00:00:00 2001 From: Simon Waddington Date: Thu, 1 Feb 2018 13:46:36 -0800 Subject: [PATCH] Make sqrt function examples run --- src/main/scala/scalatutorial/sections/LexicalScopes.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/scalatutorial/sections/LexicalScopes.scala b/src/main/scala/scalatutorial/sections/LexicalScopes.scala index 94f76263..af840511 100644 --- a/src/main/scala/scalatutorial/sections/LexicalScopes.scala +++ b/src/main/scala/scalatutorial/sections/LexicalScopes.scala @@ -33,7 +33,7 @@ object LexicalScopes extends ScalaTutorialSection { * (guess + x / guess) / 2 * * def isGoodEnough(guess: Double, x: Double) = - * abs(square(guess) - x) < 0.001 + * math.abs(guess * guess - x) < 0.001 * * sqrtIter(1.0, x) * } @@ -96,7 +96,7 @@ object LexicalScopes extends ScalaTutorialSection { * (guess + x / guess) / 2 * * def isGoodEnough(guess: Double) = - * abs(square(guess) - x) < 0.001 + * math.abs(guess * guess - x) < 0.001 * * sqrtIter(1.0) * }