Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


float search is broken

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 120

PostPosted: Wed Nov 25, 2015 8:10 pm    Post subject: float search is broken Reply with quote

Hi, for a while now, i've noticed that float type search is broken. When i search for EXACT value such as 1.0, it finds values like 1.1, 1.12934 1.034292 ...etc
If i search for RANGE from -0.5 to 0.5 it finds values like 7.1, 2.32, 1.291 .... how to fix this?

If i tell it to find between -0.5 and 0.5 then I don't expect to see values smaller than -0.5 and greater than 0.5, but seems like CE completely ignores what i tell it to do. I included a screenshot.

Is there a fix for this?


Another not so important issue, is that float search does not find anything if i search for longer values, like "1.12345678", it just shows 0 results.
If i search for "1.12345" then it finds "1.12345678" + ton of other values starting with "1.12345****" ... why?
Isn't EXACT field for finding ... umm .... exact values? If i know it exists, which it does, then how come CE can't find? ..yet it does find if i use non-exact value.
Tsearch and ArtMoney don't have this issue, but they're bit too slow compared to CE and Tsearch doesn't work with 64-bit apps (in case some1 asks "OMG WHY NOT USE OTHER TOOLS THEN OMG")
This issue is not very important, but would be nice to have fix for this.



PS: Trolls please, do not start asking me "why you need this" "Omg you don't use float" ...etc, If there would be another way, i would not be asking here :) I need to find float values between that range.



noobengine.PNG
 Description:
 Filesize:  26.55 KB
 Viewed:  11748 Time(s)

noobengine.PNG


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Nov 25, 2015 8:22 pm    Post subject: Reply with quote

Nothing is broken. You just don't understand how rational numbers work.

Your problem with exact value searches can be explained by going through this webpage. You can change how you round values on the right side of the window just under the search box (i.e. rounded(default), rounded(extreme), truncated).

Your problem with value between searches can be explained by this webpage.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Nov 26, 2015 2:21 am    Post subject: Reply with quote

the screenshot you posted is correct
7.255519874E-39=0.000000000000000000000000000000000000007255519874
which falls between -0.5 and 0.5


it also depends on your input how precise it is. If you scan for 1 you'll get a lot more results than when you scan for 1.0000000
and yes, some values just can't be encoded exactly the way you wish

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Nov 26, 2015 4:20 pm    Post subject: Reply with quote

Searching for "1.12345" will find "1.12345678" and tons of others, like "1.12345xxxxx".


To be more precise, use "1.12345000", it should find "1.12345" and some "1.12345000xx"

_________________
Back to top
View user's profile Send private message MSN Messenger
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 120

PostPosted: Sun Nov 29, 2015 6:00 pm    Post subject: Reply with quote

Dark Byte wrote:
the screenshot you posted is correct
7.255519874E-39=0.000000000000000000000000000000000000007255519874
which falls between -0.5 and 0.5


it also depends on your input how precise it is. If you scan for 1 you'll get a lot more results than when you scan for 1.0000000
and yes, some values just can't be encoded exactly the way you wish


Well in games, 7.2xxxx is NOT 0.00000000000000000000000000007
I understand what float values are, but this is not how they are shown in a game.
You can't store such numbers on 4 bytes, perhaps the problem is that there is no bytes in float option.

I mean, 99% of games that i've hacked, allocate 4 bytes, even if less is needed. Therefore 0.0000000000000000000000000000000000000000000007432432 values are invalid and never correct.

I hope this makes sense. maybe you can add option to display values between 0.0 and 1.0 that are within like 10 places after 0.
I have never seen a single game that uses values longer than that, those results are just "invalid" and non relevant.

for example in lot of games, RGB (car color for example) are stored in FLOAT values between 0.0 and 1.0

1.0 R = 100% RED
It's like the hue, if you mix it with other colors .. you get yellow, purple ..etc
Making a color hack with "broken" CE is very difficult.
So i'd like to have some option that would make it easier.
i know that values are like 50% RED = 0.504939392 something like that, it never goes more than 10 places after 0.

Anyway thanks for explaining why it shows up, but i still think it's very useless and could use improvements. hope you understand that i'm trying to improve CE by suggesting this idea as current method is useless in most cases.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Nov 29, 2015 7:15 pm    Post subject: Reply with quote

mordax wrote:
Well in games, 7.2xxxx is NOT 0.00000000000000000000000000007

If the game says something is 7.2xxxx, why would you search for anything else? Just do an exact value search for 7.2. That way, no very small or very large numbers will pop up.

mordax wrote:
I understand what float values are, but this is not how they are shown in a game.

No, you don't understand. Here's a fact of life:
What you perceive to be true doesn't necessarily have to be true.
In this case, what shows up in-game doesn't necessarily have to match up with what's actually stored on your computer. Most of the time, it's not, since most rational numbers can't be perfectly represented as a finite sum of powers of 2 (how floats are stored). As such, games tend to round off to a certain point so that this imprecision isn't noticed by whoever is playing the game. Doing operations with these imprecise values could eventually lead to values like 7.432432E-46, which wouldn't be 0 if you could search for 0 precisely. As such, CE is protecting narcissists like you from your own hubris.
This website might be able to explain it to you if you're still not getting it.

mordax wrote:
I mean, 99% of games that i've hacked, allocate 4 bytes, even if less is needed

Single-precision floating point numbers are represented in a 32 bit pattern (that is 4 bytes). If whatever type of data you have isn't that long, it's not a float.

mordax wrote:
i know that values are like 50% RED = 0.504939392 something like that, it never goes more than 10 places after 0.

Floats generally have about 7 digits of precision (see precision vs accuracy). The reason you don't see any numbers like that is because they can't exist for numbers greater than 0.1. You're trying to rule out values that don't even exist, so that isn't going to help you at all.
If you're certain it's greater than 0, then you'd be better off searching for a value between 0.000001 and 1. Then, you won't get any value less than 1E-6 in your found list.

mordax wrote:
Anyway thanks for explaining why it shows up, but i still think it's very useless and could use improvements. hope you understand that i'm trying to improve CE by suggesting this idea as current method is useless in most cases.

It is absolutely not useless. You're just ignorant in how floating point data is stored. If you want to learn more, you can start with the wikipedia article on floats. It adequately sums up everything.

Of course, most data isn't a float, and most of this junk would be values with a significant exponent if you were to treat them like a float. If you're certain a value can't be extremely large or extremely small, you can use the custom value type in this topic to search for floats.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Pharaoh2k
Newbie cheater
Reputation: 0

Joined: 28 Apr 2022
Posts: 20

PostPosted: Tue Jul 11, 2023 12:04 pm    Post subject: Reply with quote

Dark Byte wrote:
the screenshot you posted is correct
7.255519874E-39=0.000000000000000000000000000000000000007255519874
which falls between -0.5 and 0.5


it also depends on your input how precise it is. If you scan for 1 you'll get a lot more results than when you scan for 1.0000000
and yes, some values just can't be encoded exactly the way you wish


Would it be possible to add a feature to CE which will search for exact float numbers by internally converting them to Hex, search for the Hex value, and return the same exact float?
For example, if I am looking for (float)1.2, CE will internally search for 3F99999A when the "exact float" option is checked.
And if I am searching for 5.4 it will search for 40ACCCCD etc.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Tue Jul 11, 2023 12:43 pm    Post subject: Reply with quote

No. The encoding used by CE could be slightly different from what the game uses (e.g shift the decimal but use a value 10 times bigger would result incthe same value but different encoding)


but what you can do is scan for 1.20000000000 and 5.40000000 so the difference is almost zero

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites