Skip to content

Commit

Permalink
Creating Quad with Quad
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayamInSync committed Sep 19, 2024
1 parent 0a75b91 commit 0052e16
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions quaddtype/numpy_quaddtype/src/scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ QuadPrecision_from_object(PyObject *value, QuadBackendType backend)
self->value.longdouble_value = (long double)val;
}
}
else if (Py_TYPE(value) == &QuadPrecision_Type)
{
// todo: not working for ld backend, getting garbage value not sure why?
QuadPrecisionObject *quad_obj = (QuadPrecisionObject *)value;
// printf("%d %d\n", quad_obj->backend, backend);
// printf("%Lf\n", quad_obj->value.longdouble_value);
if (quad_obj->backend == BACKEND_SLEEF) {
self->value.sleef_value = quad_obj->value.sleef_value;
}
else {
self->value.longdouble_value = quad_obj->value.longdouble_value;
}
}
else {
PyObject *type_str = PyObject_Str((PyObject *)Py_TYPE(value));
if (type_str != NULL) {
Expand Down

0 comments on commit 0052e16

Please sign in to comment.