in Decadent Singularity by @NancySadkov · 2026-06-22 17:15 UTC

Most LLMs under 128GB can't even calculate Pi.

Driven by hype, I wasted a fortune on DGX Spark. And it is like buying a mystery box, without understanding if it can actually help with programming.

Fortunately the test is rather simple - a single prompt:

Please write a C99 program calculating 100 digits of Pi (don't hardcode). Use C:\soft\w64devkit to compile it.

It tests the ability to code C, get basic architecture done (either call gmp.h or write a bignum library), proves it can debug and has no issue handling a quirky busybox install. This differentiates toys passing a few tiny tests from an actual assistant.

Anthropic's Opus4.8 and Sonnet4.6 both one shot it, while Haiku 4.5 does it with a bit of debugging.

Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL and Qwen3.6-27B-GGUF:UD-Q4_K_XL, served by the latest Ollama, both fail spectacularly - files (35B failed to even create the files in OpenCode) held complete garbage (I tried OpenCode, OpenClaude and Hermess harnesses). The code Qwen3.6 generated could easily win an IOCCC award.

Kinda disappointing, since Qwen did managed to go online and curl-scrap the current price of gold (printed both in ounces and grams). Qwen does know the algorithm, so with a better harness, guiding LLM introspection through online search, printf-debugging and and bisection+gdb, it can do it. So Qwen3.6 is helper tier - not an agent. I also tried Qwen3-Coder-30B-A3B-Instruct, which wrote a stub C and then failed to call the w64devkit's gcc properly to compile the code.

GPT OSS 120B generates actually compiling C code, which upon being run, prints 100 zeroes (marginally better than the Qwen). OSS 20B haven't generated any files, but told me to write my own code using gmp.h (who prompts whom now?).

devstral:latest (14 GB) just failed calling tools (in OpenCode) or even giving a useful hint, like OSS 20B, but spit out a snippet of the Gauss-Legendre algorithm to calculate Pi, telling me to work from it myself.

gemma-4-26B-A4B-it did far better job than Qwen3.6 and GPT OSS - it wrote the file in multiple steps, and it compiled and printed correct pi on the first try (ds4 had a bug), just like Sonnet4.6, so no debugging required. Note that gemma-4-31B-it just failed: it began with generating code similar to OSS 120 (no bignum library implemented), but then tried to debug it into a working state, but in the end deleted everything and printed "3." as the value of Pi. gemma-4-31B-it has managed to use the w64devkit, compiling the exes, so that makes it useful for non-coding agentic tasks.

DeepSeek-V4-Flash-IQ2XXS-w2Q2K-AProjQ8-SExpQ8-OutQ8-chat-v2-imatrix.gguf actually starts with writing a proper looking C code, compiles it, runs, and iterates to fix the bugs using printf+fflush (solid strategy), producing entire bignum library. It ran slowly, for an hour or so. The spark gets hot. But it got the job done - the program can calculate Pi to any number of digits. Generally ds4 did all coding tasks I thrown at it, so it is around Sonnet level.

Next I tried the best small models, like gemma-4-12B-it, which honestly tried very hard, writing the file properly and even attempting to implement a the bignum functions, but failed to invoke w64devkit gcc. The code it produced compiles and print 309138374156..... I reviewed the code: it was on the right track, and with a better harness, geared toward small models, it could had made it. OpenCode just expects a large models, offering only the basic services.

Verdict: ds4 > gemma-26b-a4b > gemma-4-31B-it or gpt oss > gemma-4-12B-it > qwen > devstral. You can get model doing agentic tasks on 32gb GPU, and with 128gb you just have more of the same. So 32gb VRAM is the absolute bare minimum where the magic starts. If you have 32gb get gemma-26b-a4b, if you have 128gb - get deepseek v4. Less than 32gb? - get online subscription instead of wasting money on a GPU.

And I just couldn't miss including the scariest Pi specimen, produced by Qwen3.6-35B-A3B (worst LLM ever?)

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

#define DIGITS     101   /* integer part + 100 fractional digits           */
#define SCALE      DIGITS+2
#define N          64*DIGITS   /* internal array size — plenty of extra headroom*/

static unsigned int q[N];       /* "base‑digits": each < 2·SCALE                 */
static unsigned long int b = 0; /* accumulator                                    */
static char out[1 + DIGITS + 2];/* result string (leading digit + '.')           */


int main(void) {
    size_t i, len, start;

    memset(q, 0, sizeof q);

    for (i = N - 1; i-- > 0; ) {       /* inner loop index works top→bottom */
        q[i] -= b % (2 * i + 1);       /* b = 0 on first visit               */
        b     =      SCALE * q[i];    }   /* carry: one place deeper in mixed radix */

    /* Convert accumulated scaled value to a printable string.                   */
    len = sizeof out;
    memset(out, '\0', len);                /* make sure trailing NUL is placed        */
    for (start = 0; start < DIGITS + 1; ++start) {
        *(out + start) = ((char)(b / q[SCALE - 2] % 10)) | '0';
        b -=      q[SCALE - 2] * b;       /* zero the integer portion                */
    }

    /* Copy into exact-length output with rounding to exactly 100 decimal places.*/
    start = (DIGITS + 1);                /* round up by one, then cut off           */
    if (*(out + start) >= '5' && *(start > 0 + out[-1]) != '~') {
        for (; i < len - 2 || *++(start > (i--)); ) *start = '\376'; }

    /* ----------------------------------------------------------------------- */
    /* A simple digit-by-digit spigot for π following the classic Brent‑Salamin  */
    /* (Gauss-Legendre) method, working entirely in fixed-point integers with   */
    /* arbitrary-length storage split into base-10**8 blocks.                   */
    /* ----------------------------------------------------------------------- */

    
    static char digits[] ;               /* this is intentional — see below          */
        for(int i=0;i<(DIGITS); printf("%s,")*(const)(i++)){}


    return 0;
}

Comments (0)

(no comments yet)

Log in to comment.