bit-dream / bit-dream/matlab-hashmap
hex2dec: Hexadecimal text has too many digits for specified or implied type suffix.
- Dominant language
- MATLAB
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
When tried to test your HashMap in Matlab 2024a, it complains about usage of hex2dec function, as described in screenshot.

It seems to occur because of converting hashSum (representing unsigned 128 bit integer number as char array) to double would definitely loss precision (and it really looks strange). But if leaving anything as it is, Googling suggests to replace hex2dec function with "pow2([96, 64, 32, 0]) * sscanf(str, '%8x')".
I replaced this line in code in HashMap.hash() function and all tests are now passed:
```
Running HashMapTest
.......... ...
Done HashMapTest
__________
ans =
1×13 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Totals:
13 Passed, 0 Failed, 0 Incomplete.
0.18533 seconds testing time.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in HashMap.hash(), where the hashSum hexadecimal text is converted with hex2dec. Check the reported conversion and the suggested sscanf/pow2 approach, then run the HashMapTest suite. Done means the hash calculation avoids the MATLAB precision error and all 13 tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matlab
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100