Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.minus() dont work #35

Open
Piotrex311 opened this issue May 28, 2024 · 3 comments
Open

.minus() dont work #35

Piotrex311 opened this issue May 28, 2024 · 3 comments

Comments

@Piotrex311
Copy link

on godot 4.2.2 .minus() do not work

@nhold
Copy link

nhold commented Jun 17, 2024

I have tested as well, minus appears to not work when it hits this example:

Actual

10 - 1 = 90

Expected

10 - 1 = 9

and looks to be related to the normalize function:

if big.mantissa < 1.0 or big.mantissa >= 10.0:
		var diff: int = floor(log10(big.mantissa))
		if diff > -10 and diff < 248:
			var div = 10.0 ** diff
			if div > MANTISSA_PRECISION:
				big.mantissa /= div
				big.exponent += diff

From my understanding in this case the mantissa should just equal 9.

It definitely isn't right but I changed to this:

	if big.mantissa == 10.0:
		var diff: int = floor(log10(big.mantissa))
		big.mantissa -= diff
	
	if big.mantissa < 1.0 or big.mantissa > 10.0:
		var diff: int = floor(log10(big.mantissa))
		if diff > -10 and diff < 248:
			var div = 10.0 ** diff
			if div > MANTISSA_PRECISION:
				big.mantissa /= div
				big.exponent += diff

@nhold
Copy link

nhold commented Jun 17, 2024

Ah looks like the real solution is here: #32 we should close this issue and link to that.

@ChronoDK
Copy link
Owner

I don't use Godot 4 myself, so I rely on pull request to keep that version updated for now. In any case I did just commit the suggested solution to this problem - untested, so let me know if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants