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

Exponent notation of float numbers begin too early #7

Open
Xenapte opened this issue Mar 9, 2023 · 10 comments
Open

Exponent notation of float numbers begin too early #7

Xenapte opened this issue Mar 9, 2023 · 10 comments

Comments

@Xenapte
Copy link

Xenapte commented Mar 9, 2023

Currently float numbers (after conversion to string) are displayed using exponent notation if they are greater than 10^7, which is still within the limits of a normal Minecraft world, making it difficult to read if using Meteor Client to display coordinates beyond this point. There doesn't seem to be any workarounds.

20230309110406

@RacoonDog
Copy link
Contributor

case Number: { double n = getNumber(); return n % 1 == 0 ? Integer.toString((int) n) : Double.toString(n); }

@RacoonDog
Copy link
Contributor

RacoonDog commented Mar 9, 2023

Only happens with Double.toString(), so if the number has a fractional part, and is 10000000 or above

Probably possible to bypass it by rounding to an integer if the value reaches the threshold, so something like {z >= 10000000 ? round(z) : z}

@Xenapte
Copy link
Author

Xenapte commented Mar 9, 2023

Yes I'm currently using this, having figured it out some hours ago. But it would be nicer if I'm still able to see some decimal places (i round them to 2 decimal places because sometimes I want to align myself to the center of tunnels).

@RacoonDog
Copy link
Contributor

Yes I'm currently using this, having figured it out some hours ago. But it would be nicer if I'm still able to see some decimal places (i round them to 2 decimal places because sometimes I want to align myself to the center of tunnels).

You can do {round(x * 100) / 100} to achieve 2 decimal places iirc

@Xenapte
Copy link
Author

Xenapte commented Mar 9, 2023

You can do {round(x * 100) / 100} to achieve 2 decimal places iirc

No, that still gives exponent notation. Thanks for the help tho

@RacoonDog
Copy link
Contributor

You can do {round(x * 100) / 100} to achieve 2 decimal places iirc

No, that still gives exponent notation. Thanks for the help tho

Oh yeah you cant easily have both decimals and regular notation

@RacoonDog
Copy link
Contributor

@Xenapte a bit late on this, but Pos: #1{player.pos.x >= 10000000 ? round(player.pos.x) : round(player.pos.x * 100) / 100} {round(player.pos.y * 100) / 100} {player.pos.z >= 10000000 ? round(player.pos.z) : round(player.pos.z * 100) / 100} should be what you're after

@Xenapte
Copy link
Author

Xenapte commented Mar 15, 2023

Sorry for the late reply, but still the problem persists using this (I wanted to see 2 decimal places for numbers larger than 10 million) - though I did tweak this to be more robust for different coordinates: Pos: #1{abs(player.pos.x) >= 10000000 ? floor(round(player.pos.x)) : round(player.pos.x, 2)}, {round(player.pos.y, 2)}, {abs(player.pos.z) >= 10000000 ? floor(round(player.pos.z)) : round(player.pos.z, 2)}. For now I'm going to just try to get used to integer displays for large numbers.

@RacoonDog
Copy link
Contributor

Sorry for the late reply, but still the problem persists using this (I wanted to see 2 decimal places for numbers larger than 10 million) - though I did tweak this to be more robust for different coordinates: Pos: #1{abs(player.pos.x) >= 10000000 ? floor(round(player.pos.x)) : round(player.pos.x, 2)}, {round(player.pos.y, 2)}, {abs(player.pos.z) >= 10000000 ? floor(round(player.pos.z)) : round(player.pos.z, 2)}. For now I'm going to just try to get used to integer displays for large numbers.

Yeah I will try to fix the big decimals in the starscript source itself

@Xenapte
Copy link
Author

Xenapte commented Mar 16, 2023

Thanks!

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

2 participants