News for hackers. Stuff that matters.
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.