# Log long double value

**URL:** <https://forums.unrealengine.com/t/log-long-double-value/373983>\
**Category:** C++\
**Tags:** debug, unreal-engine, log, CPP, question\
**Created:** [October 21, 2016, 12:04am UTC](https://forums.unrealengine.com/t/log-long-double-value/373983 "2016-10-21T00:04:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tieran02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tieran02](https://forums.unrealengine.com/u/Tieran02)\
**Post date:** [October 21, 2016, 12:04am UTC](https://forums.unrealengine.com/t/log-long-double-value/373983/1 "2016-10-21T00:04:54Z")

</div>

I am currently working with large numbers such as \_\_int64 and long doubles and im fairly new to unreal myself. I have been spending hours trying to figure out how i can print long doubles as i need to check that all my calculations are correct but this is becoming an issue as from what i can tell UE\_LOG does not support Long Doubles only floats.

In standard c++ this won’t be an issue as i can just use printf like

`printf("%lg\n", pow(5.67 * 10,-8));`

and that works fine but when i use %lg in UE\_LOG like this

`UE_LOG(YourInit, Warning, TEXT("test = %lg"), pow(5.67 * 10,-8));`

It won’t compile.

Is there a way i can log long doubles within unreal or atleast see the output from printf?

---

<div class="post-metadata">

**Author:** ![GigasightMedia](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigasightMedia](https://forums.unrealengine.com/u/GigasightMedia)\
**Post date:** [October 21, 2016, 3:22am UTC](https://forums.unrealengine.com/t/log-long-double-value/373983/2 "2016-10-21T03:22:26Z")

</div>

You could convert the long to a std::string, convert that to FString, and then send that to the log:

```
char Buffer[100];
snprintf(Buffer, sizeof(Buffer), "test = %lg", pow(5.67 * 10, -8));
std::string StdMessage = Buffer;
FString LogMessage(StdMessage.str());
UE_LOG(YourInit, Warning, TEXT("%s"), *LogMessage);

```

That gave me: “test = 9.36129e-15” in my log.

I don’t know if there’s a more direct route, but it works.

---

<div class="post-metadata">

**Author:** ![zhirui\_li](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zhirui\_li](https://forums.unrealengine.com/u/zhirui_li)\
**Post date:** [March 8, 2023, 5:49pm UTC](https://forums.unrealengine.com/t/log-long-double-value/373983/3 "2023-03-08T17:49:12Z")

</div>

Just use %lf instead.

---

<div class="post-metadata">

**Author:** ![Broncoco52](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Broncoco52](https://forums.unrealengine.com/u/Broncoco52)\
**Post date:** [February 14, 2024, 2:38pm UTC](https://forums.unrealengine.com/t/log-long-double-value/373983/4 "2024-02-14T14:38:43Z")

</div>

`UE_LOGFMT(LogTemp, Log, "Printing three doubles: {0}, {1}, {2}", GetActorRotation().Pitch, GetActorRotation().Yaw, GetActorRotation().Roll);`

_Output Log:_  
LogTemp: Printing three doubles: 16.404666058434792, -8.4564431394870727, -46.881993375868063

more info can be found here:

> **[Logging | Unreal Engine Community Wiki](https://unrealcommunity.wiki/logging-lgpidy6i)**
>
> Printing logs via C++ at Runtime.
