Double and float formatting is uncontrollable in the Studio Properties. float and double are inconsistent in display

There have been similar Reports about this, e.g. Orientation, but it was focusing only on Orientation. Here I am focusing on the Properties display and any other Input Form that exists in Roblox Studio.

It is especially an issue with the new Aligment Feature. Because that what you see, is not that what you get. Exceptions are float types and numbers like 0.6. But where precision CAN exist, it’s not available.

This is not about Luau. This is about C++ and Properties UI in Studio.

 

Description

Unlike 0.5f

0.6f is a bit different.

image

image

#include <iostream>
#include <iomanip>

float test = 0.6f;

int main()
{
    std::cout << std::setprecision(16) << test;

    return 0;
}

image

The confusion is that in Studio, you’re shown 0.6, but the C++ type seems to be a float, especially since here it says float

<float name="Transparency">0.600000024</float>

 

The game.TextChatService.ChatWindowConfiguration.TextStrokeTransparency is of type double however.

If you do set this Instance’s Property of type double to a double type 0.49999:

game.TextChatService.ChatWindowConfiguration.TextStrokeTransparency = 0.49999
print(game.TextChatService.ChatWindowConfiguration.TextStrokeTransparency)

You’ll get shown this:
image

What’s a bit more strange is that it gets converted into this. It is not wrong, but I wonder if it’s necessary.

<double name="TextStrokeTransparency">0.49998999999999999</double>

double has a better precision though

#include <iostream>
#include <iomanip>

double test = 0.49999;

int main()
{
    std::cout << std::setprecision(16) << test << std::endl;

    return 0;
}

 

 

Studio doesn’t seem to offer the possibility to control the display of the precision. But the issue raises if you have a double type with the value 0.49999 and Studio yet displays it as 0.5

 

It causes confusion in Math.

 

This is especially an issue with the new Alignment Feature.

image

SOMETIMES you’re shown a value being set to 1, so no more floating numbers. But the Aligning Feature in Roblox could have set it to 1.00002

image

 

And this is where this post becomes an Issue but it’s also a sort of Feature Request.

 

Once I thought, I’d have moved a part to the coordinate X. But when I did simple math like X * 2, I’d get a strange number, and this would be because I thought X was 1 but it wasn’t.

 

And this is just extremely annoying, mixed with the new features Roblox gives you.

If a type is a float though and you type 0.6, since precision wise it isn’t wrong that it is 0.600000024 or different. But it is confusing if you don’t know that the type is a float or a double.

Re-production Steps

number_format_issue.rbxlx (81.1 KB)

Take the double type for example.

  1. Run print(game.Workspace["TextStrokeTransparency_0.49999"].TextStrokeTransparency)
  2. Compare the Luau Output to what it shows in the Properties at TextStrokeTransparency

 

Expected Result

Since this one is specifically a double type.
image

But in reality, I expected a Setting to control the precision in the display. The XML format, even seems to be able to even display the real float value. However, for double it’s a bit strange.

Point is that the double value 0.49999 is precise enough. Luau displays it right. Studio rounds it up. And this is confusing.

 

Actual Result

With the new Alignment Feature, you can run into an issue where you will see that the new coordinate is set to 1, while it’s set to 1.00002, because it was set to 1.00002 but you’re shown 1. And if it would be set to 1 it would only show 1, because there can’t be any other numbers after it, if it didn’t go through floating math.

image

This here is actually not wrong, it’s just a preciser version of the double value. But the thing is the value is still supposed to be 0.49999 in the Properties UI

<double name="TextStrokeTransparency">0.49998999999999999</double>

 


Additionally

I hope that this will eventually be changed without having to wait for a Luau Version of the Properties View or use of third-party Plugins. Though Luau wouldn’t be able to know whether something is a float or a double I think? It just does the type casting on its own. Apparently numbers in Luau are double

And f is a prefix but the type would remain double unless it’s changed to float.

If properties could show this :person_shrugging: typeid(VAR).name()

Studio seems to be currently doing something like this on everything for the input UI:

#include <iostream>
#include <iomanip>

double test = 0.4873;

int main()
{
    std::cout << std::setprecision(3) << test;

    return 0;
}

Just to give a bit of context here, numbers are doubles in Lua, however Roblox data types like Vector3 and CFrame have float subcomponents not double ones.

1 Like