unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Floating Point?
@ 2003-09-06 18:10 Peter S. Christopher
  2003-09-08 14:43 ` Betoes
  0 siblings, 1 reply; 6+ messages in thread
From: Peter S. Christopher @ 2003-09-06 18:10 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-09-09 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-06 18:10 Floating Point? Peter S. Christopher
2003-09-08 14:43 ` 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

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).