Finding the pattern in a set of values

  • Thread starter Thread starter martix
  • Start date Start date
  • Tags Tags
    Set
Click For Summary

Discussion Overview

The discussion revolves around understanding the relationship between a set of binary values and their corresponding multipliers, specifically in the context of single precision floating-point representation. Participants explore how to derive the multipliers from the given values and clarify aspects of binary encoding.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant presents a table of binary values and asks for help in determining how the corresponding multipliers are calculated.
  • Another participant suggests that the values represent the most significant bits of single precision floating-point numbers and provides a formula for calculating the multiplier.
  • A different participant asserts that the values are not single precision numbers and proposes dividing the numbers by 65536 to find a match.
  • Further clarification is provided regarding the little-endian format of the data and the presence of leading zeros in the structure.
  • Participants express gratitude for the insights shared and acknowledge the clarity provided by the table format.

Areas of Agreement / Disagreement

There is no consensus on the correct interpretation of the values as some participants argue they are single precision representations while others contest this and suggest a different approach. The discussion remains unresolved regarding the exact nature of the values and their relationship to the multipliers.

Contextual Notes

Participants note that the values may be affected by their representation in little-endian format and the potential omission of bytes in the original data. There is also mention of the need for further clarification on the mathematical steps involved in deriving the multipliers.

martix
Messages
167
Reaction score
5
I have this set of binary values, but the way to arrive at them remains a mystery. I would appreciate some help on that issue.
Code:
Value(LEndian)	Start Diff	Prev Diff	Resulting Multiplier
16256		+0		+0		1
16272		+16		+16		1.125
16288		+32		+16		1.25
16320		+64		+32		1.5
16384		+128		+64		2
16512		+256		+128		4
16640		+384		+128		8
16768		+512		+128		16
16896		+640		+128		32
The question being how do you arrive at the corresponding multiplier from the given value.
 
Technology news on Phys.org
Hi martix! :smile:

Your Value is the 'single precision' float representation of your Resulting Multiplier.
Or to be more precise, only the top two bytes that should be in there.
See this wiki page for details: http://en.wikipedia.org/wiki/Single_precision

If you want a formula, it's:
Multiplier = (1 + \frac {Value \textrm{ MOD } 128} {128}) \cdot 2^{Value \textrm{ DIV } 128 - 127}
In this formula MOD means to take the remainder after division.
And DIV means to take the integer part after division.

Btw, you missed 2 bytes in your Value. It's supposed to be a 4 byte value.
Those 2 bytes would have been zero for the numbers you've put into your table.
But the consequence would be that the numbers in your Value column should actually be 65536 times as large.
 
Last edited:
Those values are the 16 most significant bits of single precision (32 bit floating point) numbers:

Code:
multiplier      hex      decimal   hex   value
 1.0000 => 3f800000 = 1065353216  3f80 = 16256
 1.1250 => 3f900000 = 1066401792  3f90 = 16272
 1.2500 => 3fa00000 = 1067450368  3fa0 = 16288
 1.5000 => 3fc00000 = 1069547520  3fc0 = 16320
 2.0000 => 40000000 = 1073741824  4000 = 16384
 4.0000 => 40800000 = 1082130432  4080 = 16512
 8.0000 => 41000000 = 1090519040  4100 = 16640
16.0000 => 41800000 = 1098907648  4180 = 16768
32.0000 => 42000000 = 1107296256  4200 = 16896
 
Last edited:
rcgldr said:
Those aren't single (32-bit) numbers. For single precision numbers:

Divide your numbers by 65536 and you'll find a match.

Actually, I had just edited my previous post to explain that. ;)
 
I like Serena said:
Divide your numbers by 65536 and you'll find a match.
Actually, I had just edited my previous post to explain that.
Was in the process of updating my post, it's fixed now.
 
rcgldr said:
Was in the process of updating my post, it's fixed now.

Nice table! It clarifies quite neatly what is going on. :smile:
 
I just had a massive FACEPALM. How I didn't see that I have no idea.
The data was in little endian and there were a lot of zeros before those values in every structure they were present so that might have been it.

Anyway, thank you very much!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 23 ·
Replies
23
Views
6K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 35 ·
2
Replies
35
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K