﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 4  » Getting values to display number up to two decimal points</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Fri, 18 Sep 2026 01:07:50 GMT</lastBuildDate><ttl>20</ttl><item><title>Getting values to display number up to two decimal points</title><link>https://forums.millisecond.com/Topic16479.aspx</link><description>Hello,&lt;br/&gt;&lt;br/&gt;I am programming a task in which participants can earn money by guessing correctly. The cumulative money they have won is displayed in the corner of the screen so they can keep track of how much money they've made. I'd like the text to display they money they've made, with two zeros after the decimal point so it looks like a monetary value (e.g., $3.50), rather than what it shows now, which is just one place after the decimal ($3.5). How would I do this? Here's are some sample pieces of code that are relevant. Thanks in advance for your help!&lt;br/&gt;&lt;br/&gt;**where I define value parameters:&lt;br/&gt;&lt;br/&gt;&amp;lt;values moneyparams&amp;gt;&lt;br/&gt;/ balance_total = 2.00&lt;br/&gt;/ prevtotal = 0&lt;br/&gt;/ currency = "$"&lt;br/&gt;/ gainincentive = .50&lt;br/&gt;/ loseincentive = .50&lt;br/&gt;/ correctguess = 0&lt;br/&gt;/ correctguessIn = 0&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;**where I define the text that displays the participant's balance.&lt;br/&gt;&lt;br/&gt;&amp;lt;text balance_total&amp;gt;&lt;br/&gt;/ items = ("&amp;lt;%values.currency%&amp;gt; &amp;lt;%values.balance_total%&amp;gt; ")&lt;br/&gt;/ fontstyle = ("Verdana", 4.0%, true, false, false, false, 5, 0)&lt;br/&gt;/ halign = left&lt;br/&gt;/ hjustify = center&lt;br/&gt;/ vjustify = center&lt;br/&gt;/ size = (25%, 10%)&lt;br/&gt;/ position = (80%, 16%)&lt;br/&gt;/ txcolor = (green)&lt;br/&gt;/ txbgcolor = (black)&lt;br/&gt;/ erase = false&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;</description><pubDate>Wed, 10 Jun 2015 10:54:59 GMT</pubDate><dc:creator>aghartley</dc:creator></item><item><title>RE: Getting values to display number up to two decimal points</title><link>https://forums.millisecond.com/Topic16480.aspx</link><description>You can use the the format() function to do that:&lt;br/&gt;&lt;br/&gt;&amp;lt;values moneyparams&amp;gt;&lt;br/&gt;/ balance_total = 2.00&lt;br/&gt;/ prevtotal = 0&lt;br/&gt;/ currency = "$"&lt;br/&gt;/ gainincentive = .50&lt;br/&gt;/ loseincentive = .50&lt;br/&gt;/ correctguess = 0&lt;br/&gt;/ correctguessIn = 0&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;**where I define the text that displays the participant's balance.&lt;br/&gt;&lt;br/&gt;&amp;lt;text balance_total&amp;gt;&lt;br/&gt;/ items = ("&amp;lt;%values.currency%&amp;gt; &amp;lt;%&lt;strong&gt;format(~"%.2f~", values.balance_total)&lt;/strong&gt;%&amp;gt; ")&lt;br/&gt;/ fontstyle = ("Verdana", 4.0%, true, false, false, false, 5, 0)&lt;br/&gt;/ halign = left&lt;br/&gt;/ hjustify = center&lt;br/&gt;/ vjustify = center&lt;br/&gt;/ size = (25%, 10%)&lt;br/&gt;/ position = (80%, 16%)&lt;br/&gt;/ txcolor = (green)&lt;br/&gt;/ txbgcolor = (black)&lt;br/&gt;/ erase = false&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial mytrial&amp;gt;&lt;br/&gt;/ ontrialbegin = [values.prevtotal=values.balance_total]&lt;br/&gt;/ ontrialend = [values.balance_total=values.prevtotal+values.gainincentive]&lt;br/&gt;/ stimulusframes = [1=balance_total]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block myblock&amp;gt;&lt;br/&gt;/ trials = [1-5=mytrial]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;</description><pubDate>Wed, 10 Jun 2015 10:54:59 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>