Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

float FJsonObject::GetNumberField returns wrong values


It seems that float FJsonObject::GetNumberField returns wrong values. It's not always wrong, but maybe every two numbers in the 16842749 area.

I can reproduce it very easily with the following code. numberFloat and numberDouble should mean 16842749 in both cases, but the float version is different.

 FString jsonDocument(TEXT("{\"Id\":16842749}"));
 TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());
 TSharedRef< TJsonReader<> > JsonReader = TJsonReaderFactory<>::Create(jsonDocument);
 if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid())
     float numberFloat = JsonObject->GetNumberField(FString(TEXT("Id")));
     double numberDouble = JsonObject->GetNumberField(FString(TEXT("Id")));
     GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, 
         FString::Printf(TEXT("Id float: %f\nId double: %f"),
             numberFloat, numberDouble));

alt text

Product Version: UE 4.14
more ▼

asked Mar 10 '17 at 09:14 PM in Bug Reports

avatar image

59 6 13 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

My bad, Unreal only implements the double version. It's a float issue.

VaRest cast the double to float, so I guess the problem is from VaRest that uses floats when it should use double.

more ▼

answered Mar 11 '17 at 07:24 AM

avatar image

59 6 13 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question