News for hackers. Stuff that matters.
Re:How does your programming language handle “minus zero” (-... by quelsolaar on Friday March 05, 2021 @09:33AM (#26357240)
As someone who has started out making games on Playstation 1 that didn't have floating point hardware, I can with authority say that developing games with only integers suck. Floating point number are far easier and robust to use.
Re:How does your programming language handle “minus zero” (-... by scrooched_moose on Friday March 05, 2021 @10:34AM (#26357953)
Isn't that what caused the PS1 graphics "wobble"? I remember you could just stare at a wall, rotate the camera, and the textures would slightly jitter and move. It's really obvious in some the Metal Gear cutscenes, especially this conversation with Donald Anderson where the camera pans up from the floor (at 15m) or the sweep(15m31s):

https://www.youtube.com/watch?v=VLTqIXZ1jQQ#t=15m00s

I never had a PS1 but it always bugged me when playing on someone elses.

Re:How does your programming language handle “minus zero” (-... by coopierez on Friday March 05, 2021 @11:04AM (#26358325)
This is because of two things: the affine texture mapping was incorrect, and there was no sub-pixel precision. The sub-pixel part is kinda float-related (though you could make use of fixed point too).
Re:How does your programming language handle “minus zero” (-... by codetrotter on Friday March 05, 2021 @11:00AM (#26358280)
> I never had a PS1 but it always bugged me when playing on someone elses.

Conversely I like the fact a lot that it does. And some others that probably have fond memories of PS1 too recreated this on modern computers using shaders.

https://github.com/dsoft20/psx_retroshader

Re:How does your programming language handle “minus zero” (-... by quelsolaar on Friday March 05, 2021 @11:15AM (#26358471)
yes, and the PS1 had a vector unit built in to the CPU that was used for world transform and it was only 24 bits.

Early PS1 games fit the entire world in to a 24 bit space, and you can tell that there is steping if you drive very slow in a game like Ridge Racer. Later games moved the world around in the coordinate system to manage precision.

Another reason why the graphics looks extra "popy" on PS1 (And early DirectX games) is that vertices where computed at a pixel accuracy. OpenGL, Doom, Quake and more modern hardware have sub pixel accuracy.

Re:How does your programming language handle “minus zero” (-... by edflsafoiewq on Friday March 05, 2021 @11:53AM (#26358991)
No. The DS uses only fixed point numbers and does not wobble.
Re:How does your programming language handle “minus zero” (-... by ajuc on Friday March 05, 2021 @11:14AM (#26358459)
Did you use macros/operator overloading for all that bit shifting or just hardcoded it everywhere?

We made a simple 3d demo for uni using fixed math (and we were clueless then and weren't using macros because sometimes you could refactor some operations out that way and we wanted all the speed). There were lots of bugs caused by this.

Can't imagine how painful writing a whole game this way would be.

Re:How does your programming language handle “minus zero” (-... by pfraze on Friday March 05, 2021 @10:09AM (#26357623)
Only integers? Wow. Were int pairs used to represent numbers with decimals or what?
Re:How does your programming language handle “minus zero” (-... by salicideblock on Friday March 05, 2021 @10:29AM (#26357862)
In signal processing on constrained domains (constrained including the lack of an FPU), the usual alternative to floating point is "fixed point" arithmethic.

Basically you use the platform's native types (e.g. uint32) and decide which of the bits are for the integer part and which are for the fractional. uint32 can be interpreted as 20/12 for example. Your register went from representing "units" to representing "2^-12 increments of an unit". The ALU can do sum/comparison/subtractions transparently, but multiplications and (god forbid) divisions require shifting to return to the original representation.

The choice of how to split the bits is a tradeoff between range and precision. It can vary from one routine to another. It's a pain to compose code with it.

Short story: native float types are a blessing for programmer productivity and library interoperability.

Re:How does your programming language handle “minus zero” (-... by okl on Friday March 05, 2021 @11:33AM (#26358743)
The Wikipedia page explains the operations: https://en.wikipedia.org/wiki/Q_(number_format)
Re:How does your programming language handle “minus zero” (-... by timerol on Friday March 05, 2021 @10:19AM (#26357747)
To use only integers, you generally try to express all numbers in units of the smallest quantity. So any money is in integer cents, any distance is in integer (spatial resolution size). It gets annoying with derived units: Time can be stored in integer frames, but then you'll need a rational type of some kind to properly handle velocity. Or you just round to the nearest (spatial resolution) per frame and hope the errors don't look too weird on the other side.
Re:How does your programming language handle “minus zero” (-... by linkdd on Friday March 05, 2021 @10:31AM (#26357917)
Let's say you have two 4 bits integer to form an 8 bit decimal number:

1111.1111 is (1 + 2 + 4 + 8) + (1/2 + 1/4 + 1/8 + 1/16)

Re:How does your programming language handle “minus zero” (-... by coopierez on Friday March 05, 2021 @11:05AM (#26358332)
The GPU made use of fixed point numbers. So you have a set number of decimal places for a number.