# Scientific notation for large numbers

**URL:** <https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963>\
**Category:** Programming & Scripting\
**Tags:** math, unreal-engine, Blueprint, question\
**Created:** [December 11, 2024, 11:43pm UTC](https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963 "2024-12-11T23:43:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blsports5911](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Blsports5911](https://forums.unrealengine.com/u/Blsports5911)\
**Post date:** [December 11, 2024, 11:43pm UTC](https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963/1 "2024-12-11T23:43:21Z")

</div>

Good afternoon,

I am currently working on creating an idle game. I am having some troubles though when it comes to large numbers. What I am trying to avoid is having numbers like 1,000,000,000,000 display instead have 1.11 e6 or 1k, 1m, 1b, etc. I currently am trying to do this in blueprints. I have searched on the internet and did some research and the best thing I could come up with is this line of code:

 ![unreal forums help](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/c/1ac17021afad5656591e525ac4507a3ee2b5bbfe.png)  
I then just keep doing this line of code for every new value (1,000-10,000-100,000-etc). This seems very inefficient and doesn’t seem to be the best way. I thought about resetting the value to 1 every time it hit these marks but not sure how that would best work. Any help on this would be great or just some insight before I start down this rabbit hole. I am currently at e13 and it still seems to work perfectly. but just feels like there is a better way. I am currently using UE5.4. Thanks in advance for all the help!

---

<div class="post-metadata">

**Author:** ![Nawrot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nawrot/32/618260_2.png) [@Nawrot](https://forums.unrealengine.com/u/Nawrot)\
**Post date:** [December 12, 2024, 12:54am UTC](https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963/2 "2024-12-12T00:54:53Z")

</div>

Make Blueprint functions library.  
Create there PURE function that has number and exponent as variables  
calculate value inside function  
Then use that pure function as input.

---

<div class="post-metadata">

**Author:** ![Blsports5911](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Blsports5911](https://forums.unrealengine.com/u/Blsports5911)\
**Post date:** [December 12, 2024, 4:08am UTC](https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963/4 "2024-12-12T04:08:29Z")

</div>

So im trying to make sure i did this right. Here is my blueprint function code:

 ![unreal forums 2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/4/414f0e49a717fa157b36a46c3f3c73674801e797.png)

then in the widget where i output the value. Did i follow your example correctly?

 ![unreal forums 3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/a/38adf937ab5fdd5f1c8152c4f8414f6738e10d8c.png)

Now is this the most efficient way to do this and would I still need to do this bit of code for each 1,000-10,000-100,000 and so on?

---

<div class="post-metadata">

**Author:** ![Nawrot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nawrot/32/618260_2.png) [@Nawrot](https://forums.unrealengine.com/u/Nawrot)\
**Post date:** [December 12, 2024, 9:36am UTC](https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963/5 "2024-12-12T09:36:24Z")

</div>

Trying to make this automatic, using MAP variable that holds number of zeros (for eg kilo - 3 zeros). It is (will be) nice to use. But code gets complicated. So give me some more time. 😉

I think/hope this works correctly:

Make function library, and create this one in. Make it PURE.

 ![search map for base 10](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/1/d511aa5351a72f59410d6c2243ff26921c4255fb.jpeg)

In map you declare NUMBER of ZEROS, not multiplier. However make sure it gets it correctly.  
Also whole code assumes that this map is sorted by number of zeros.

 ![base 10 map declaration](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/4/5d4a4bdc20fa6a606c0cdf62939bc999eccfa391.jpeg)

With function library and pure function, you can use this anywhere:

 ![base 10 usinf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/5/635cdfe8f7cbf0ab9b8db87ab1abcf9d9f527ac5.jpeg)

ps.  
It does not divide value by base 10 exp, so a bit altering is required. 😉

pps.  
You can declare that EXP\_MAP variable in separate EXP\_MAP function in function library. Make it pure, then use everywhere THAT function like you would use normal variables. This way you have exp and names declared in single place. Easier to keep track, i foresee very long table with numbers of zeros

---

<div class="post-metadata">

**Author:** ![Blsports5911](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Blsports5911](https://forums.unrealengine.com/u/Blsports5911)\
**Post date:** [December 30, 2024, 8:50pm UTC](https://forums.unrealengine.com/t/scientific-notation-for-large-numbers/2208963/6 "2024-12-30T20:50:28Z")

</div>

So after being on break and being able to just spend tons of time on it, I was able to find a way to make this work using exponents.(IE 1.23E4) I had to delve into loge nodes with a power nodes but was able to figure it out. Now for the K, mil, bil, tril, etc that’s another story but for now it works perfect and I thank you for all your time and help. Also I didn’t want to just leave you hanging on my progress.
