๐งต Untitled Thread
Anonymous at Tue, 5 Mar 2024 18:17:17 UTC No. 16058457
can someone help me understand this gay bullshit
bodhi at Tue, 5 Mar 2024 18:21:08 UTC No. 16058469
>>16058457
You see there are norms and denorms
Anonymous at Tue, 5 Mar 2024 18:22:18 UTC No. 16058474
Anonymous at Tue, 5 Mar 2024 18:24:06 UTC No. 16058478
>>16058457
After 10 seconds of looking at your pic and having no idea of computer science, it looks like a standard to express really small numbers as floats
bodhi at Tue, 5 Mar 2024 18:27:06 UTC No. 16058487
>>16058474
normalizing a floating point number just means chopping off x amount of digits c being defined by the user as insignificant. Say for example you are writing a program for trading currenecy. The yen is a 3 digit float while most other currencies are a 5 digit float. What if you want to do some math operation between them? You have to normalize your vars to a three digit float with some function. In MQL4 you use Normalize("PAIR", <number of floating point digits>).
bodhi at Tue, 5 Mar 2024 18:31:02 UTC No. 16058497
think of normalizing as similar to finding a common denominator
Anonymous at Tue, 5 Mar 2024 18:31:46 UTC No. 16058499
>>16058497
>>16058487
helpful thank you
bodhi at Tue, 5 Mar 2024 18:32:28 UTC No. 16058501
this might help. I actually use this function all the time in the trading bots I write
https://docs.mql4.com/convert/norma
yw
bodhi at Tue, 5 Mar 2024 18:40:44 UTC No. 16058521
>>16058499
What are you using it for? Think of it as a substring function but for doubles instead of strings
Anonymous at Tue, 5 Mar 2024 18:46:19 UTC No. 16058537
>>16058521
Im learning binary for an micro assembly class, so I dont have a real world use for it yet. I just find all the different interpretations of the same thing confusing
such as: 0 0000 0001. this can be interpreted as either normalized or denormalized?
bodhi at Tue, 5 Mar 2024 18:51:11 UTC No. 16058545
>>16058537
your leading digit is zero so it is not normalized
Anonymous at Tue, 5 Mar 2024 18:52:07 UTC No. 16058549
>homework thread
bodhi at Tue, 5 Mar 2024 18:52:57 UTC No. 16058553
>>16058537
your image at the top looks more like something from a statistics class than a CS class t b h
Anonymous at Tue, 5 Mar 2024 19:44:11 UTC No. 16058655
>>16058487
>>16058497
>>16058501
That's not the type of normalization this is referring to. Floating point numbers use a k-bit exponent balanced at 0, so it could represent values in the range [-2^(k-1)+1, 2^(k-1)]. However, the minimum exponent as in
>>16058537
is special cased to represent subnormal numbers (and the maximum exponent to represent infinities and NaNs), so the exponent actually takes values in the range [-2^(k-1)+2, 2^(k-1)-1]. In normal numbers, the mantissa bits represents a number in the range [0,1): The first bit is 1/2, the second bit 1/4, the third bit 1/8, and so on, and there is an implied additional 1, so all normal numbers have a mantissa in the range [1,2). So your mantissa, if that number was normal, would be 1+1/16.
However, your exponent is all 0s, meaning the number is subnormal. For subnormal numbers, the implied additional 1 on the mantissa is dropped, and the mantissa represents a number in the range [0,1). So your mantissa is 1/16. The exponent is the same as the minimum exponent for normal numbers, which is -6: this exponent is represented by the bits 0001 for normal numbers, and the bits 0000 for subnormal numbers.
So you have
>sign bit
0, positive
>exponent
0000, subnormal number, value -6
>mantissa
0001, representing the value 2^-4 (since the number is subnormal)
So that number is 2^-6*2^-4 = 2^-10.
Anonymous at Tue, 5 Mar 2024 19:53:29 UTC No. 16058670
>>16058655
And the reason this is important is usually performance. Subnormal numbers are much slower than normal numbers on most architectures, since the hardware is built for normal numbers and calculations involving subnormals trap and are implemented in microcode, taking many instructions. You can disable this behavior and flush them to 0 if you don't need to accurately represent nonzero values smaller than the smallest normal numbers. So if your numerical computations or physics simulations or whatever end up being 100 times slower sometimes, check if you're getting subnormal numbers.