removed outdated file
Gitea Actions For Fabelous-Math / Explore-Gitea-Actions (push) Successful in 19s
Details
Gitea Actions For Fabelous-Math / Explore-Gitea-Actions (push) Successful in 19s
Details
This commit is contained in:
parent
fc840bb42b
commit
0a25cdf333
|
@ -1,34 +0,0 @@
|
||||||
#include <Python.h>
|
|
||||||
#include "sqrt.hpp"
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
static PyObject* fabelous_sqrt_wrapper(PyObject* self, PyObject* args) {
|
|
||||||
long long number;
|
|
||||||
if (!PyArg_ParseTuple(args, "L", &number)) { // Ensure 'L' is correct for long long
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
double result = fabelous_sqrt::sqrt(number); // Adjust to match the actual return type
|
|
||||||
return PyFloat_FromDouble(result);
|
|
||||||
} catch (const std::invalid_argument& e) { // Ensure this is the correct exception
|
|
||||||
PyErr_SetString(PyExc_ValueError, e.what());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyMethodDef SqrtMethods[] = {
|
|
||||||
{"fabelous_sqrt", fabelous_sqrt_wrapper, METH_VARARGS, "Compute the square root of a long number"},
|
|
||||||
{NULL, NULL, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct PyModuleDef sqrt_module = {
|
|
||||||
PyModuleDef_HEAD_INIT,
|
|
||||||
"sqrt",
|
|
||||||
"Module for computing the square root of a number",
|
|
||||||
-1,
|
|
||||||
SqrtMethods
|
|
||||||
};
|
|
||||||
|
|
||||||
PyMODINIT_FUNC PyInit_sqrt(void) {
|
|
||||||
return PyModule_Create(&sqrt_module);
|
|
||||||
}
|
|
Loading…
Reference in New Issue