From: "Peter S. Christopher" <peterc@midway.uchicago.edu>
Subject: Floating Point?
Date: Sat, 6 Sep 2003 13:10:21 -0500 (CDT) [thread overview]
Message-ID: <Pine.GSO.4.21.0309061236500.11544-100000@harper.uchicago.edu> (raw)
Hi there listers,
I've been thinking about how to make my floating point
calculations go faster. I thought that my FP calculations where so slow
because of excessive allocation. i.e. if a and b are floats then
(+ a b) will return a *NEW* float with the value a+b in it. Is this
true? If this where true I thought that I could speed up my calculations
by replacing the normal operands (+,-,*,/) by versions that don't allocate
new cells (a-la (reg+, reg-, reg*, reg/)). Something like
(reg+ temp_1 a b)
would evaluate to
SCM_REAL_VALUE(temp_1) =
scm_num2dbl(a, FUNC_NAME)+scm_num2dbl(b, FUNC_NAME);
in some C extension function. This would prevent the allocation of the
additional doubles. The real advantage, of course, would be in expressions
like
(let ((register-1 0.0))
(do ((i 0 (+ i 1))
((> i big-huge-number))
(set-my-double-array i
(reg+ register-1 5.7 (reg* register-1 3.1 i))))))
where this loop sets element i of my-double-array to 3.1*i+5.7. By my
reasoning (which may be suspect) this would save me many-many cell
allocations (2*big-huge-number to be exact).
So how far off base am I? And, does anyone have other ideas on how
to improve my floating point performance (within the guile world that is).
Thanks for any help,
Pete Christopher
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next reply other threads:[~2003-09-06 18:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-06 18:10 Peter S. Christopher [this message]
2003-09-08 14:43 ` Floating Point? Betoes
2003-09-09 7:52 ` tomas
2003-09-09 9:26 ` David Allouche
2003-09-09 14:34 ` Peter S. Christopher
2003-09-09 21:15 ` Robert Uhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.21.0309061236500.11544-100000@harper.uchicago.edu \
--to=peterc@midway.uchicago.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).