Issue #15066 has been updated by Eregon (Benoit Daloze).


v0dro (Sameer Deshmukh) wrote:
> > Isn't it enough to just use rb_funcall() to call Ruby methods on Complex numbers?
> 
> Calling Ruby methods in C extensions defeats the purpose of writing a C extension since a non-trivial number of Ruby method calls take up significant time.

The existing Ruby methods should already be fast enough for most cases.
C macros/functions for accessing the real and the imaginary parts seems fine, but I think not more than that should be exposed for Complex.

----------------------------------------
Feature #15066: Documentation and providing better API for accessing Complex numbers functions in C extensions
https://bugs.ruby-lang.org/issues/15066#change-73897

* Author: v0dro (Sameer Deshmukh)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Currently there is absolutely no documentation for working with Complex numbers at the level of the C API.

Apart from two macros defined [[here](https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1079)] for setting the real and imag
values of Complex numbers there is no 'official' way of working with Complex numbers at the level of the C API.

I propose two things:
* Fully document existing Complex number routines.
* Provide a robust and efficient API for dealing with complex numbers from C extensions.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>