Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: =?UTF-8?Q?Nagy_L=c3=a1szl=c3=b3_Zsolt?= Newsgroups: comp.lang.python Subject: Re: Can math.atan2 return INF? Date: Mon, 27 Jun 2016 15:27:51 +0200 Lines: 12 Message-ID: References: <57697e61$0$1590$c3e8da3$5496439d@news.astraweb.com> <1mp7m3g.picev12e77h4N%pdorange@pas-de-pub-merci.mac.com> <5769ec9e$0$22142$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de Vf8/kOV0xrxgSJ7sGkt5PAWZsCIWQU+gmIQIJtwlZw4A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'happen.': 0.09; 'library?': 0.09; 'sure)': 0.09; 'exception': 0.13; '(but': 0.15; 'inf': 0.16; 'nan': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'result,': 0.18; 'math': 0.20; 'thanks,': 0.24; 'header:In- Reply-To:1': 0.24; "doesn't": 0.26; 'least': 0.27; 'function': 0.28; 'relies': 0.29; "i'm": 0.30; 'up.': 0.32; 'returned': 0.32; 'maybe': 0.33; 'point': 0.33; 'except': 0.34; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'to:addr:python.org': 0.40; 'where': 0.40; 'ever': 0.60; 'charset:windows-1252': 0.62; 'between': 0.65; '100%': 0.72; 'angle,': 0.84; 'blow': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopzeus.com; s=shopzeus_com; t=1467034071; bh=5/m2IenA+/9eyFuUxPyO2OOEtVuoRyDH/RI0SRvkYwA=; h=Subject:To:References:From:Date:In-Reply-To:From; b=KJRe7LBDMKb3Y2R1FsEYgYBKKmwijV922BI0jOysplTnO6x3Z2C/qBzjqbbuJsuqJ FVIp9OABKPU/G1zHiuG/khq7oh3KFxnGDA1RJyBVf4MBo+/+2NfcSS0CNYA1jMa0ky gEY84UZPx1NoefDLa9VD7KdnNdCPAo/gn+2xS/ZU67ebdEDQxZoKRgdG2uz05OL/Ej UcNAwY8rIUFkxqDP2h6Vzo3Uqg2kkpLwyBcoekvcNj6pq6tvMrWFe6ZYA+atyWlLPO xpg1RHoVsB3VFbcm4I5kevcKLtkEYnK2+inmapwehu2uDHcEPGONw2SmrlaLBLxCa/ zc//nrLiXi7eQ== In-Reply-To: <5769ec9e$0$22142$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <57697e61$0$1590$c3e8da3$5496439d@news.astraweb.com> <1mp7m3g.picev12e77h4N%pdorange@pas-de-pub-merci.mac.com> <5769ec9e$0$22142$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:110578 > Thanks, I'm in the same position as you, except that I'm in the position > where I need it use the result, and if it ever returns INF my function will > blow up. But it doesn't look like that can happen. > Doesn't atan2 relies on the C lib math floating point library? At least in CPython. I think (but not 100% sure) that it is implementation dependent, and returns what is returned by clib floating point lib. Since the meaning of atan2 is an angle, it should always be between [-pi,pi]. The only exception maybe when there is a NaN in the arguments. But I cannot think of any interpretation where atan2 would return Inf or -Inf.