From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: ratio implementation Date: Fri, 17 Oct 2003 10:04:43 -0500 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87brsfgb1w.fsf@raven.i.defaultvalue.org> References: <3F250809.9030108@ccrma.stanford.edu> <87smmyibk7.fsf@zagadka.ping.de> <3F6637EC.7010004@dirk-herrmanns-seiten.de> <3F66F68B.3070100@ccrma.stanford.edu> <3F6A1F1A.8000507@dirk-herrmanns-seiten.de> <87pth9cbmt.fsf@zagadka.ping.de> <3F8A853D.1020708@ccrma> <87oewjcrwq.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066403802 2813 80.91.224.253 (17 Oct 2003 15:16:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Oct 2003 15:16:42 +0000 (UTC) Cc: Bill Schottstaedt , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Oct 17 17:16:40 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AAWLH-0008W7-00 for ; Fri, 17 Oct 2003 17:16:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AAWJG-0006tr-TY for guile-devel@m.gmane.org; Fri, 17 Oct 2003 11:14:34 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AAWAQ-0004C7-4X for guile-devel@gnu.org; Fri, 17 Oct 2003 11:05:26 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AAW9s-00042P-7p for guile-devel@gnu.org; Fri, 17 Oct 2003 11:05:23 -0400 Original-Received: from [66.93.216.237] (helo=defaultvalue.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AAW9o-00040n-QT for guile-devel@gnu.org; Fri, 17 Oct 2003 11:04:49 -0400 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id B7B3F3FB3; Fri, 17 Oct 2003 10:04:43 -0500 (CDT) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id 7503483018; Fri, 17 Oct 2003 10:04:43 -0500 (CDT) Original-To: Marius Vollmer In-Reply-To: (Marius Vollmer's message of "Fri, 17 Oct 2003 12:09:02 +0200") User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2897 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2897 Marius Vollmer writes: > Yes, that's what I was looking for. I now have in scm_inexact_to_exact > > else if (SCM_REALP (z)) > { > mpq_t frac; > SCM q; > mpq_init (frac); > mpq_set_d (frac, SCM_REAL_VALUE (z)); Do you need a scm_remember_upto_here1(z) here, or is z already protected? > q = scm_make_ratio (scm_i_mpz2num (mpq_numref (frac)), > scm_i_mpz2num (mpq_denref (frac))); Also, can scm_make_ratio throw? If so, then I'm wondering if frac might be a potential memory leak, in which case, one solution would be to just allocate frac via scm_i_mkbig(). > mpq_clear (frac); > return q; > } -- Rob Browning rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel