aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/bigint.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-11-09 18:42:16 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-11-09 18:42:16 -0500
commit1d461611bac782c272d0e082d5da74b4fe353ae6 (patch)
tree0b1687a3edb507835f9aa3b7666fd590975b73ff /src/stdlib/bigint.h
parent78fd9141bb7dfcf817158a7a4d098e0e4b3d515b (diff)
Rename Num -> Float64, Num32 -> Float32
Diffstat (limited to 'src/stdlib/bigint.h')
-rw-r--r--src/stdlib/bigint.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/stdlib/bigint.h b/src/stdlib/bigint.h
index 614e1501..e50a6847 100644
--- a/src/stdlib/bigint.h
+++ b/src/stdlib/bigint.h
@@ -1,4 +1,5 @@
// Big integer type (`Int` in Tomo)
+#pragma once
#include <gmp.h>
#include <stdbool.h>
@@ -189,13 +190,13 @@ MACROLIKE PUREFUNC bool Int$is_negative(Int_t x) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
-MACROLIKE PUREFUNC Int_t Int$from_num(double n, bool truncate) {
+MACROLIKE PUREFUNC Int_t Int$from_float64(double n, bool truncate) {
mpz_t result;
mpz_init_set_d(result, n);
if (!truncate && unlikely(mpz_get_d(result) != n)) fail("Could not convert to an integer without truncation: ", n);
return Int$from_mpz(result);
}
-MACROLIKE PUREFUNC Int_t Int$from_num32(float n, bool truncate) { return Int$from_num((double)n, truncate); }
+MACROLIKE PUREFUNC Int_t Int$from_float32(float n, bool truncate) { return Int$from_float64((double)n, truncate); }
MACROLIKE Int_t Int$from_int64(int64_t i) {
if likely (i >= SMALLEST_SMALL_INT && i <= BIGGEST_SMALL_INT) return (Int_t){.small = (i << 2L) | 1L};
mpz_t result;