Skip to content

Exponent notation of float numbers begin too early #7

Open

Description

@Xenapte

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

Activity

  1. crosby-moe commented on Mar 9, 2023

    @crosby-moe
    Contributor

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

  2. crosby-moe commented on Mar 9, 2023

    @crosby-moe
    Contributor

    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}

  3. Xenapte commented on Mar 9, 2023

    @Xenapte
    Author

    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).

  4. crosby-moe commented on Mar 9, 2023

    @crosby-moe
    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

  5. Xenapte commented on Mar 9, 2023

    @Xenapte
    Author

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

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

  6. crosby-moe commented on Mar 9, 2023

    @crosby-moe
    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

  7. crosby-moe commented on Mar 13, 2023

    @crosby-moe
    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

  8. Xenapte commented on Mar 15, 2023

    @Xenapte
    Author

    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.

  9. crosby-moe commented on Mar 15, 2023

    @crosby-moe
    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

  10. Xenapte commented on Mar 16, 2023

    @Xenapte
    Author

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions