🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #21411

Re: przypisac nieskonczonosc

#21411
From: Grzegorz Makarewicz
Date: Wed, 17 Oct 2007 08:58
34 lines
2091 bytes
Seweryn Habdank-Wojewódzki wrote:

> Ale mnie interesuje, więc co zrobisz? Jak napisałbyś kod rozróżniający te
> dwa byty?
> 
> Jak napiszesz taki kod dla mnie podam ci przykładziki kiedy potrzebuję to
> obsłużyć.


Już wymyślili - w pythonie jest odpowiednia bateria ;)

from decimal import *

# Inf
inf = Decimal(1) / Decimal(0)
print inf

# NaN
c = Context()
c.traps[InvalidOperation] = 0
nan = c.divide(Decimal(0), Decimal(0))
print nan

Pewnie chciałbyś te informacje mieć prosto z rozszerzeń napisanych w C ?
Jeżeli nie chcesz korzystać z wyjątków to nie masz szansy na wyłapanie
tych przypadków:

inf = 1.0 / 0.0
print inf

nan = 0.0 / 0.0
print nan

mak
Technical Details
Message-ID: <ff4ir9$29c$1@opal.futuro.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!not-for-mail
References: <20071016103416.e69a7bc7.sulsa@dontmail.me> <1192526464.122236.16990@v23g2000prn.googlegroups.com> <ff21gb$l2i$1@news.vectranet.pl> <1192533601.905010.17440@y27g2000pre.googlegroups.com> <ff28jc$rkt$1@news.vectranet.pl> <1192538475.635966.79370@z24g2000prh.googlegroups.com> <ff2cc5$vg0$1@news.vectranet.pl> <1192544706.206962.324280@q3g2000prf.googlegroups.com> <ff2orm$bla$1@news.vectranet.pl> <ff32c8$cng$1@opal.futuro.pl> <ff32qc$l8j$1@news.vectranet.pl> <ff34ds$h5c$5@opal.futuro.pl> <ff3453$luk$2@news.vectranet.pl> <ff35gk$ljj$1@opal.futuro.pl> <ff3796$pf5$1@news.vectranet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!not-for-mail
From: Grzegorz Makarewicz <mak@trisoft.com.pl>
Newsgroups: pl.comp.lang.python
Subject: Re: przypisac nieskonczonosc
Date: Wed, 17 Oct 2007 10:58:58 +0200
Organization: TriSoft Sp. z o.o.
Lines: 34
Message-ID: <ff4ir9$29c$1@opal.futuro.pl>
References: <20071016103416.e69a7bc7.sulsa@dontmail.me> <1192526464.122236.16990@v23g2000prn.googlegroups.com> <ff21gb$l2i$1@news.vectranet.pl> <1192533601.905010.17440@y27g2000pre.googlegroups.com> <ff28jc$rkt$1@news.vectranet.pl> <1192538475.635966.79370@z24g2000prh.googlegroups.com> <ff2cc5$vg0$1@news.vectranet.pl> <1192544706.206962.324280@q3g2000prf.googlegroups.com> <ff2orm$bla$1@news.vectranet.pl> <ff32c8$cng$1@opal.futuro.pl> <ff32qc$l8j$1@news.vectranet.pl> <ff34ds$h5c$5@opal.futuro.pl> <ff3453$luk$2@news.vectranet.pl> <ff35gk$ljj$1@opal.futuro.pl> <ff3796$pf5$1@news.vectranet.pl>
NNTP-Posting-Host: static-62-233-216-18.devs.futuro.pl
Mime-Version: 1.0
X-Trace: opal.futuro.pl 1192611497 2348 62.233.216.18 (17 Oct 2007 08:58:17 GMT)
X-Complaints-To: usenet@futuro.pl
NNTP-Posting-Date: Wed, 17 Oct 2007 08:58:17 +0000 (UTC)
User-Agent: Icedove 1.5.0.10 (X11/20070329)
In-Reply-To: <ff3796$pf5$1@news.vectranet.pl>
X-Enigmail-Version: 0.94.2.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit