rounding and formatting decimals (forced) | XM Community
Skip to main content
Solved

rounding and formatting decimals (forced)

  • September 29, 2018
  • 2 replies
  • 253 views

I have some embedded data random decimal values that I am using to form my questions. I have them rounded like this: $$e{ round( e://Field/Savings , 2 ) } this works great when the values are not divisible by .1, which then will show along the lines of $4.2 Is there any way to format to show 2 decimals, even when the 100's spot is a zero? (would like it to show $4.20)

Best answer by PeeyushBansal

You can calculate using JavaScript and store it as embedded https://stackoverflow.com/questions/6134039/format-number-to-always-show-2-decimal-places

2 replies

PeeyushBansal
Level 6 ●●●●●●
Forum|alt.badge.img+43
  • Level 6 ●●●●●●
  • Answer
  • September 29, 2018
You can calculate using JavaScript and store it as embedded https://stackoverflow.com/questions/6134039/format-number-to-always-show-2-decimal-places

  • Author
  • September 29, 2018
ahhh, so not just using the normal block question setup. Now why couldn't this be an undocumented feature like mod (%) in the math section... 😀