summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/jets/c/sqt.c
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-05 21:56:51 +0700
committerpolwex <polwex@sortug.com>2025-10-05 21:56:51 +0700
commitfcedfddf00b3f994e4f4e40332ac7fc192c63244 (patch)
tree51d38e62c7bdfcc5f9a5e9435fe820c93cfc9a3d /vere/pkg/noun/jets/c/sqt.c
claude is gud
Diffstat (limited to 'vere/pkg/noun/jets/c/sqt.c')
-rw-r--r--vere/pkg/noun/jets/c/sqt.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/vere/pkg/noun/jets/c/sqt.c b/vere/pkg/noun/jets/c/sqt.c
new file mode 100644
index 0000000..b20db59
--- /dev/null
+++ b/vere/pkg/noun/jets/c/sqt.c
@@ -0,0 +1,33 @@
+/// @file
+
+#include "jets/q.h"
+#include "jets/w.h"
+
+#include "noun.h"
+
+
+ u3_noun
+ u3qc_sqt(u3_atom a)
+ {
+ mpz_t a_mp, b_mp;
+
+ u3r_mp(a_mp, a);
+ mpz_init(b_mp);
+ mpz_sqrtrem(a_mp, b_mp, a_mp);
+
+ return u3nc(u3i_mp(a_mp), u3i_mp(b_mp));
+ }
+ u3_noun
+ u3wc_sqt(u3_noun cor)
+ {
+ u3_noun a;
+
+ if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
+ (c3n == u3ud(a)) )
+ {
+ return u3m_bail(c3__exit);
+ } else {
+ return u3qc_sqt(a);
+ }
+ }
+