HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
status-im
nim-stint
Nim2018–2023
status-im / nim-stint

nim-stint

Stack-based arbitrary-precision integers - Fast and portable with natural syntax for resource-restricted devices.

3Distinct people
6Mentions
0Explicit recommenders
93GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Stack-based arbitrary-precision integers - Fast and portable with natural syntax for resource-restricted devices.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year6 dated mentions

Observed mentions: 2018-05-03 08:47:03 UTC to 2023-07-03 21:11:13 UTC.

01232018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC303
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC110

What Hacker News says

6 sources
> I think the message is more nuanced I thought it was more nuanced too as they were explaining how integer types can be derived, until I finished the article, and they really did just seem to be complaining that there's a mismatch between compile time and run time. Dynamic types don't really solve the problems they mention as far as I can tell either (perhaps I am misunderstanding), they just don't provide any guarantees at all and so "work" in the loosest sense. > otherwise wouldn't lisp with its homoiconicity and compile time macros fit the bill perfectly? That's a good point, I do wonder why they didn't mention Lisp at all. > we don't have a solution yet What they want to do with print can, as far as I can see, be implemented in Nim easily in a standard, imperative form, without any declarative shenanigans. Indeed, it is implemented a
Read the rest
s part of the stdlib here: https://github.com/nim-lang/Nim/blob/ce44cf03cc4a78741c423b2... Of course, that implementation is more complex than the one in the article because it handles a lot more (e.g., formatting and so on). At the end of the day, it's really a capability mismatch at the language level and the author even states this: > Programming languages ought to be rethought. I'd argue that Nim has been 'rethought' specifically to address the issues they mention. The language was built with extension in mind, and whilst the author states that macros are a bad thing, I get the impression this is because most languages implement them as tacked on substitution mechanisms (C/C++/Rust/D), and/or are declarative rather than "simple" imperative processes. IMHO, most people want to write general code for compile time work (like Zig), not learn a new sub-language. The author states this as well. Nim has a VM for running the language at compile time so you can do whatever you want, including the recursive type decomposition (this lib isn't implementing Peano arithmetic but multiprecision stack based bignums): https://github.com/status-im/nim-stint and specifically here: https://github.com/status-im/nim-stint/blob/ddfa6c608a6c2a84... func zero*[bits: static[int]](T: typedesc[Stuint[bits] or Stint[bits]]): T {.inline.} = ## Returns the zero of the input type discard func one*[bits: static[int]](T: typedesc[Stuint[bits]]): T {.inline.} = ## Returns the one of the input type result.data = one(type result.data) It also has 'real' macros that aren't substitutions but work on the core AST directly, can inspect types at compile time, and is a system language but also high level. It seems to solve their problems, but of course, they simply might not have used or even heard of it.
In Why static languages suffer from complexity
The 3-by-2 division is from Burnikel and Ziegler [1][2] with a nice comparison from Hasselstrom between division approaches. OpenSSL has introduced another 3 by 2, but this one is written with constant-time concerns for cryptography [4] [1]: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.47.... [2]: https://github.com/status-im/nim-stint/blob/bae3fc6/stint/pr... [3]: http://bioinfo.ict.ac.cn/~dbu/AlgorithmCourses/Lectures/Hass... [4]: https://github.com/openssl/openssl/pull/7589
In Donald Knuth’s Algorithm D, its implementation in Hacker’s Delight and elsewhere
Easiest way to start with nim is via choosenim: https://github.com/dom96/choosenim then `nimble install https://github.com/status-im/nim-stint` Unfortunately I didn't have time to focus on documentation but the easiest way to get started with Stint is to check the tests: https://github.com/status-im/nim-stint/tree/master/tests. The casts are there to check binary representation compatibility in the tests and are not needed otherwise. Alternatively you can check: - https://github.com/FedeOmoto/nim-gmp, A GMP wrapper (very low-level/C-like and not updated since 2015) - https://github.com/status-im/nim-decimal, a arbitrary-precision floating point wrapper to MpDecimal (used by python). Unfortunately it's very low-level/C-like at the moment.
In A Programming Language Underdog
I would be very interested in the test suite you used. I've finished my own bigint implementation in the Nim language: - stack and power-of-2 only for uint256, uint512, uint1024, etc), - using recursive types (uint128 = 2x uint64, uint256 = 2x uint128). It is already quite optimized (division using Burnikel and Ziegler recursive division for example), but I want to make sure it works fine. https://github.com/status-im/nim-stint
In Adding BigInts to V8

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.