Follow

int main() {
float x, y, z;
for (x=0, y=1, z=y; x<y; y+=z);
printf("%f\n", x);
}

ohhh this has a bad bug. to fix it:

for (x=0, y=1, z=y; x<y; x=y, y+=z);

@mxsparks
ghci> round $ until (ap (==) succ) succ (0 :: Float)
16777216

@mxsparks this rust is … not good

fn f(x: &mut f32, brk: Option<&()>) -> Option<()> {
    loop {
        if *x == 1.0 + *x {
            brk?;
        }
        *x += 1.0;
    }
}

fn run(x: &mut f32) {
    f(x, [].first());
    println!("{}", x);
}

fn main() {
    run(&mut 0f32);
}

@velartrill @mxsparks rust with no [LOUD CAR HORN] has obvious fun bits such as "can't hop out of loop" and "can't throw anything out of your function if it's a loop", but also "can't say a binding".

@velartrill @mxsparks i did try tail calls at first but 16 million tail calls is too tall

@mxsparks I still don't really know what the second post means, butt at least now x actually changes :P

@mxsparks so is the {sum} bit about adding all the numbers between 0 and infinity?
(I think I get the joke, anyway)

@shoofle not with floats! you can only go as high as your significand's width

@mxsparks ohhh, how cool! I didn't catch that it's using floats.

Sign in to chat along
Oulipo.social (Mark II)

Mastodon is a "FOSS" social sharing hub. A multi-host substitution for capitalistic platforms, it avoids risking a particular company monopolizing your communication. Pick a host that you trust — you can still talk with all hosts running Mastadon. Any individual can run a Mastodon instantiation and join in this social hub in a jiffy.