[C++-sig] buildin converter for long double
jiangzuoyan at gmail.com
jiangzuoyan at gmail.com
Tue Nov 6 03:25:04 CET 2012
how about return a wrap type of long double to cheating boost/python, and
register youself converter as
PyObject * o = PyArrayScalar_New(LongDouble);
PyLongDoubleScalarObject * s = (PyLongDoubleScalarObject*)o;
s->obval = value;
Don't forget to call import_array() in your model init function.
BTW, I think float128 is not useful, it's slow. and in most case, change
algorithm to avoid precision problem is another *better* approach.
Changsheng Jiang
On Mon, Nov 5, 2012 at 6:27 PM, Holger Brandsmeier <brandsmeier at gmx.de>wrote:
> Dear list,
>
> the boost python buildin converter for long double:
> BOOST_PYTHON_TO_PYTHON_BY_VALUE(long double,
> ::PyFloat_FromDouble(x), &PyFloat_Type)
> converter/builtin_converters.hpp
> identifies long double, which on my system is a 128bit float, with a
> 64bit float in python. I would like to identify it with numpy`s
> float128. Can you give me any hings how I would be able to do that?
>
> -Holger
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20121106/eecc3abe/attachment.html>
More information about the Cplusplus-sig
mailing list