Hacker News new | ask | show | jobs
by jdiff 5 days ago
I got stuck for a bit code golfing a fixed-point multiply routine. For a signed multiply, I got down to 32 instructions.

Decided to see how much better Astra 6.2 on High would be able to do. Threw two five-hour windows and a reset that was about to expire at it, and it actually lost, it couldn't crack 33 instructions. Outputs of both solution were correct within an acceptable error margin that was communicated to Astra. Quite odd to see because I'm quite confident 32 still leaves room for improvement.

2 comments

>Astra 6.2 on High

FWIW, OpenAI recommends using Extra High or Max on 6.2 where you would have used High beforehand.

Extra High is the sweet spot where 6.2 really starts to shine without taking too long.

Actually it is the other way around
Nope, here's directly from an OpenAI employee: https://x.com/pvncher/status/2123082577741255153
Nah, they are full of shit.

Either tibo or ambrossino tweeted the other way around.

But yeah, token spend must go brr

Or, yknow, you're remembering wrong?
Nah, they were quoting all the benchmarks, saying like medium is the old high
> For a signed multiply, I got down to 32 instructions.

gist pls

https://gist.github.com/different55/08aff15e0f3b67b1feb1fd16...

It's for the Uxn VM, it's a multiply between a signed sample and an unsigned Q13 coefficient. My coefficients are almost always positive, or known negative in advance. If negative, I rewrite an ADD2 in the filter into a SUB2.

Ground rules for Astra were that JMP2r's (returns) aren't counted, no use of the zero page, and it must return the correct result within 9LSBs, which is the error from skipping the smallest partial product.

Signed multiply means doing multiplication on signed numbers. So you have to care about and implement rules about positive and negative numbers. Fixed point means numbers where the decimal point in a real number is at a fixed point. You can have 4 numbers before the decimal and 5 after; 1 before, 12 after; etc.

This essentially lets you treat the number as an integer.

Code golf is the practice of writing code with the fewest possible number of lines or instructions.

If he was doing this on a particular processor, he could be talking about assembler instructions.

But basically, what he's saying is that he wrote an algorithm that correctly multiplies two arbitrary positive or negative numbers using only 32 instructions.

I believe the poster you're replying to meant gist as in GitHub gist, in other words asking for a code snippet of the 32-instruction signed multiply
Ha. Touche indeed. Was not aware of that feature of Github. My bad, carry on.
ya
If only we had the means to actually ask for something like that in a manner readily understood by the average Hacker News reader.
gh gist pls
I assume they wanted a hosted code snippet as a gist on GH