Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Sat, 12 Sep 2020 08:18:31 -0700 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 08CF7kO8003874; Sat, 12 Sep 2020 11:08:00 -0400 Received: from outgoing-exchange-5.mit.edu (OUTGOING-EXCHANGE-5.MIT.EDU [18.9.28.59]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 08CF7jTY003838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 12 Sep 2020 11:07:45 -0400 Received: from oc11exedge1.exchange.mit.edu (OC11EXEDGE1.EXCHANGE.MIT.EDU [18.9.3.17]) by outgoing-exchange-5.mit.edu (8.14.7/8.12.4) with ESMTP id 08CF7hcv008696 for ; Sat, 12 Sep 2020 11:07:45 -0400 Received: from oc11expo6.exchange.mit.edu (18.9.4.11) by oc11exedge1.exchange.mit.edu (18.9.3.17) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Sat, 12 Sep 2020 11:07:20 -0400 Received: from oc11exhyb8.exchange.mit.edu (18.9.1.113) by oc11expo6.exchange.mit.edu (18.9.4.11) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Sat, 12 Sep 2020 11:07:25 -0400 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.52) by oc11exhyb8.exchange.mit.edu (18.9.1.113) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Sat, 12 Sep 2020 11:07:25 -0400 Received: from MWHPR1601CA0003.namprd16.prod.outlook.com (2603:10b6:300:da::13) by MWHPR01MB2414.prod.exchangelabs.com (2603:10b6:300:40::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Sat, 12 Sep 2020 15:07:25 +0000 Received: from CO1NAM03FT026.eop-NAM03.prod.protection.outlook.com (2603:10b6:300:da:cafe::23) by MWHPR1601CA0003.outlook.office365.com (2603:10b6:300:da::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Sat, 12 Sep 2020 15:07:25 +0000 Received: from elasmtp-masked.atl.sa.earthlink.net (209.86.89.68) by CO1NAM03FT026.mail.protection.outlook.com (10.152.80.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16 via Frontend Transport; Sat, 12 Sep 2020 15:07:24 +0000 Received: from [73.100.204.40] (helo=localhost.localdomain) by elasmtp-masked.atl.sa.earthlink.net with esmtpa (Exim 4) (envelope-from ) id 1kH77a-000C19-RC for piclist@mit.edu; Sat, 12 Sep 2020 11:07:22 -0400 From: Dave Tweed To: "piclist@mit.edu" Sender: "piclist-bounces@mit.edu" Date: Sat, 12 Sep 2020 08:07:22 -0700 Subject: Re: [AVR] square on AVR Thread-Topic: [AVR] square on AVR Thread-Index: AdaJF/nf4DiZ1EpZSDy8L8j3jjFwDw== Message-ID: <1599908842@dtweed.com> References: List-Help: List-Subscribe: , List-Unsubscribe: , Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: Fail (protection.outlook.com: domain of dtweed.com does not designate 209.86.89.68 as permitted sender) receiver=protection.outlook.com; client-ip=209.86.89.68; helo=elasmtp-masked.atl.sa.earthlink.net; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mitprod.onmicrosoft.com; s=selector2-mitprod-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SbrGuybmtF4J52eCx51BjsBqL25sUE/beacKPAB65H0=; b=HdfR7HF0GDvl+Kf2p7N3tq77r3M5SS5K1LMrbB0YFS4xVCEFxPylOQOecwEQKB8EDfbWAbfCgSmJv5CA8Mr/K0KRHuxsmT0nz7BRguo2NukBCQOfJi+lRsV1VuwYA1UViZ3KpGRd/0O31+3tSduH1FT8JSQV1JEyLHr5P68J5Oc= authentication-results: spf=fail (sender IP is 209.86.89.68) smtp.mailfrom=dtweed.com; mit.edu; dkim=none (message not signed) header.d=none;mit.edu; dmarc=fail action=none header.from=dtweed.com; x-originating-ip: 73.100.204.40 errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-elnk-trace: 5507fdf0269a8d2672cc1e1b0924a179239a348a220c260964a95fd8fb11b57da5ffae22ca922b503ca473d225a0f487350badd9bab72f9c350badd9bab72f9c x-topics: [AVR] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 > I could use the last value as a starting value for the square root. > Obviously the iron temperature won't be changing terribly fast, so > that's a good suggestion. Indeed, a single iteration of Newton-Raphson should be all you need. In the case of square root, all you need to do is divide the current input by the previous sqaure root, and then average that result with the previous square root to get the new square root. The "rule of thumb" with this method is that the number of correct bits in the answer is basically doubled on each iteration. So as long as the temperature hasn't changed enough to invalidate half of the bits in the current answer, you're good to go. Even at startup, when the "previous answer" is simply taken as some fixed nonzero value (e.g., 2), this will converge within a few cycles to the correct answer. -- Dave Tweed --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .