@mbr@mastodon.gamedev.place
@mbr@mastodon.gamedev.place avatar

mbr

@mbr@mastodon.gamedev.place

jack of no trades

This profile is from a federated server and may be incomplete. Browse more on the original instance.

mbr, to random
@mbr@mastodon.gamedev.place avatar

Random thought: It's weird how our pattern matching brains latch on things. I've the impression that there's been a burst of papers on e-graphs and equality saturation but I can see why and it's probably a false impression.

cfbolz, to random
@cfbolz@mastodon.social avatar

I just learned that there are floating point numbers that have non-unique (positive) square roots:

>>>> s = {4.472135954999575e-155, 4.472135954999576e-155, 4.472135954999577e-155, 4.472135954999578e-155, 4.472135954999579e-155, 4.4721359549995795e-155, 4.47213595499958e-155}
>>>> len(s)
7
>>>> {x * x for x in s}
{2e-309}

(I suppose it's obvious in hindsight, but I still didn't expect it somehow)

mbr,
@mbr@mastodon.gamedev.place avatar

@cfbolz Yeah. the interval [1,4) maps to [1,2).

svat, to random
@svat@mathstodon.xyz avatar

Wrote up a quick post mentioning Don Knuth's latest toy program he put up on his website: https://shreevatsa.net/post/dek-partition-square/ (Mostly just some context and explaining what the problem is; for anyone who'd like to just read the actual program directly, I have a typeset version at: https://shreevatsa.github.io/knuth-literate-programs/programs/perfect-partition-square.pdf )

mbr,
@mbr@mastodon.gamedev.place avatar

@pervognsen @amonakov @svat Aside: "It's basically him just throwing up gang signs." Excellent.

mbr, to random
@mbr@mastodon.gamedev.place avatar

I'd never noticed that a high percentage (~19.3%) of Warren's references in Hacker's Delight are just "personal communication with X". Random thought of the day.

mbr,
@mbr@mastodon.gamedev.place avatar

@amonakov I'm trying to remind myself of the "black magic" behind Guy Steele's software PDEP/PEXT

TomF, to random
@TomF@mastodon.gamedev.place avatar

Just got caught up on The Discourse of CPU design and this article: https://hackaday.com/2024/03/21/why-x86-needs-to-die/

Let me skip to the chase - it argues that x86 is shit because it's got variable-length encoding, is out-of-order, and does speculative execution. It then says ARM and RISC-V are much better.

Er... except they also do all those things in the fast chips. Which the writer clearly didn't know. So they're not just wrong, they're ignorant.

mbr,
@mbr@mastodon.gamedev.place avatar

@TomF Perhaps sampling error but every time I've landed on hackaday it's been a bad take. The last time was some person wanting to compute exp(x)-1, did a bunch of math and came with with a worse version (that only looked better with their example cases) when expm1 was sitting there all along.

adrian, to random
@adrian@discuss.systems avatar

I know how dumb this sounds, but I think it’s overwhelming how many more 64-bit numbers there are than 32-bit numbers. it’s, like, a lot.

mbr,
@mbr@mastodon.gamedev.place avatar

@adrian log2(2^64 - 2^32) = ~63.9999999997

mbr,
@mbr@mastodon.gamedev.place avatar

@adrian @shwestrick Humm. I don't know the space but let's spitball at 2^24 cores then each would need to perform 2^40 (x2 for ref and candidate) functions. Well that can be shaved down an order or two with NaNs and if the func is odd or even.

grumpygamer, to random
@grumpygamer@mastodon.gamedev.place avatar

I think the root is my problem is I'm generating floats from n-m. I needs it to be blazing fast and it can't use any libs because I need 100% consistency across platforms.

mbr,
@mbr@mastodon.gamedev.place avatar

@TomF @grumpygamer @arghdos 16-bits to give some "space" so that the product with (m-n) doesn't round? Anyway I'd want to reorder the product and use an explicit FMA (assuming that's good for target device).

mbr, to random
@mbr@mastodon.gamedev.place avatar

This DuckDuckGo being down thing is making me realize just how many web searches I perform per day.

dpiponi, to random
@dpiponi@mathstodon.xyz avatar

Given a random number generator that generates points uniformly in the unit interval [0,1] can you generate uniformly distributed points in the unit circle using only algebraic functions? In a finite number of steps - so no rejection sampling, loops, recursion. No "almost always" finite either.

Just wondering about sitiations where it seems you can't avoid trig functions.

mbr,
@mbr@mastodon.gamedev.place avatar

@dpiponi In the case of LDS you can like this:

https://rene.ruhr/gfx/adoption/

Doesn't work for IID.

mbr,
@mbr@mastodon.gamedev.place avatar

@narain @BoydStephenSmithJr @dpiponi As an aside you can get a good approximation of normal dist with hardware popcount. Sorry this is poorly written.

https://marc-b-reynolds.github.io/distribution/2021/03/18/CheapGaussianApprox.html

mbr,
@mbr@mastodon.gamedev.place avatar

@modularformsboy @dpiponi This wouldn't be a good choice anyway. You can compute {sin(π x), cos(π x)} to very high accurate with few term using a minimax approximation. Add in the symmetry of the problem and you kill off the range reduction that would be needed for a "standard" sincospi function.

lritter, to random
@lritter@mastodon.gamedev.place avatar

interesting problem: progressively mapping a cosmically high number of unique strings of arbitrary length to an ordered set so that we can assign an index to each string, extract a substring from each index, and filter strings not in the set.

evidently, this approach requires compression. the compressed result is functionally equivalent to a regular expression, or a schema validation system.

mbr,
@mbr@mastodon.gamedev.place avatar

@lritter Huh. Today's XKCD:

https://xkcd.com/2934/

mbr, to random
@mbr@mastodon.gamedev.place avatar

On twitter @sebbbi mentions a cheap approximation of sin(π x) on [-1,1]

sin(π x)/4 ≈ x - x |x|

Normally if we want a two term approximation of an odd function we're stuck with the form:

a(x) = c₁ x + c₃ x³

but if we move away from pure polynomials then another two term form is possible:

b(x) = k₁ x + k₂ x |x|

and this generalizes to however many term odd/even function approximations (filling in otherwise skipped powers with one as abs which spit into two subexpressions w & w/o abs)

mbr,
@mbr@mastodon.gamedev.place avatar

@sebbbi As an example:

f(x) = 4 atan(x)/π on [-1,1]

the abs error approximated as forms a(x) and b(x). orange & blue respectively.

demofox, to random
@demofox@mastodon.gamedev.place avatar

Hey @mbr , I remember you did that LDS thing with integers where you had an integer representation of Phi.
How did you calculate that integer version of Phi?
Did you just multiply phi by the the maximum value the int could represent and convert to int (floor / round)?

mbr,
@mbr@mastodon.gamedev.place avatar

@demofox Yeap. And to get a maximum length sequence for the bit width you round to odd.

mbr, (edited )
@mbr@mastodon.gamedev.place avatar

@demofox So [0,N) where N is now not a power of two: t = NΦ, find 'd' which is the nearest integer to 't' which is coprime with N? 'd' is the additive constant and the iteration visits all the elements. Sounds right to me.

mbr,
@mbr@mastodon.gamedev.place avatar

@demofox Oh. General audience clarification: since Φ > 1 I should have explicitly stated using (Φ mod 1)...the fractional part.

demofox, to random
@demofox@mastodon.gamedev.place avatar

For folks that know me as "the blue noise guy", I've put together a 50 minute video that talks about many of the things I've learned in my ~decade long dive into noise and related topics - up to and including our latest paper published days ago at I3D.
I hope you enjoy it!
https://www.youtube.com/watch?v=tethAU66xaA

A slide showing how random numbers which are positively correlated on the screen give correlated resulting renders, uncorrelated random numbers give uncorrelated renders, and negative correlation random numbers give negatively correlated renders. Negatively correlated renders have the best perceptual quality, despite all three having the same actual error.

mbr,
@mbr@mastodon.gamedev.place avatar

@dougmerritt @demofox Nod. But "real" random isn't any fun.

mbr,
@mbr@mastodon.gamedev.place avatar

@demofox @dougmerritt To expand. With pseudo-random (or LDS) you have a set of known properties. And the fact you can repeat exactly the same sequences (or subset thereof) is of great value. Real random is a niche thing that's only has limited usefulness in "security" IMHO.

yiningkarlli, to random
@yiningkarlli@mastodon.gamedev.place avatar

I guess I never did really think about why we call them trees.

https://twitter.com/Anthony_Bonato/status/1787499373712077233

mbr,
@mbr@mastodon.gamedev.place avatar

@yiningkarlli I wonder if this is intended as self deprecating humor considering the state of "math naming stuff".

fatlimey, to random
@fatlimey@mastodon.gamedev.place avatar

A new number coding contender enters the ring. https://arxiv.org/pdf/2404.18603

image/png

mbr,
@mbr@mastodon.gamedev.place avatar

@fatlimey Le sigh. I think this was my biggest double-take moment.

mbr,
@mbr@mastodon.gamedev.place avatar

@pervognsen @fatlimey I'm guessing not. Same author's thesis was on unums.

dubroy, to random

New blog post: Bytecode VMs in surprising places
https://dubroy.com/blog/bytecode-vms-in-surprising-places/

Most people probably associate bytecode VMs with general-purpose programming languages. But sometimes they appear in surprising places!

mbr,
@mbr@mastodon.gamedev.place avatar

@pervognsen @dubroy I don't know what either GCC or clang is doing today but (considering) converting a integer multiply by constant to shift/add/sub sequence can be handled as a mini VM.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • mdbf
  • everett
  • tacticalgear
  • magazineikmin
  • thenastyranch
  • rosin
  • tester
  • Youngstown
  • khanakhh
  • slotface
  • ngwrru68w68
  • kavyap
  • DreamBathrooms
  • JUstTest
  • InstantRegret
  • osvaldo12
  • GTA5RPClips
  • ethstaker
  • normalnudes
  • Durango
  • cisconetworking
  • anitta
  • modclub
  • cubers
  • Leos
  • provamag3
  • lostlight
  • All magazines