Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Consider an RNG.


I consider a floating point RNG in a shader that is seeded for reproducibility to be a bad idea.


Why, pray?


GPUs often have weird sizes for optimal behavior and you have to depend on math-based optimizations never being applied to your code.

In my opinion, floating point shaders should be treated as a land of approximations.

You asked in another comment why /width*width isn't optimized out by the compiler. But it's changes just like that that will break an RNG!


> In my opinion, floating point shaders should be treated as a land of approximations.

Fine, but that leaves you responsible for the breakage the shader of an author that holds the opposite opinion, as he is entitled to do. Precision =/= accuracy.


But do you want /width*width to be optimized? Or associative and commutative operations in general? Then you have to reject the opposite opinion.


> But do you want /width*width to be optimized?

I do. But I don't see such optimisation as anything to with your changing float type.


Changes like that will break just as much code as adding extra precision will. Because it will change how things round, and not much else, just like adding extra precision. They're both slightly disruptive, and they tend to disrupt the same kind of thing, unlike removing precision which is very disruptive all over.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: