trouble with number rounding

laurie bayet lauriebayet at gmail.com
Tue Sep 17 13:18:24 UTC 2013


thanks, it worked :-)

have a nice day,
laurie


2013/9/16 Paul Groot <pfc.groot at gmail.com>

> The FOrmat function will be able to do this for you. (See the E-Basic help
> documentation for a complete description with examples)
>
> score = Format$(percent/10,"0.0")
>
> or
>
> score = Format$(percent/10,"0.00")
>
> for two decimals.
>
> Paul
>
>
> On 16 September 2013 18:31, laurie <lauriebayet at gmail.com> wrote:
>
>> Hello,
>>
>> I am using a modified version of the "VisualScaleAnalog" script which is
>> recording the position of a muse click on a scale.
>>
>> Then it displays the recorded "score" to the user.
>>
>> What the original script does is this
>>
>>     Dim percent as Integer
>>     Mouse.GetCursorPos ptPress.X, ptPress.Y
>>     percent = 100*((ptPress.X-VAS_SliderDummy.Left)/sw)
>>     ...
>>     and then it displays "percent"
>>
>> So the original script would display a score of "75" if the subject
>> clicked on the 3/4th of the scale
>>
>> What i want to display is something like "7.5" instead of "75".
>>
>> I tried this :
>>
>>     Dim percent as Integer
>>     Dim score as Double
>>     Mouse.GetCursorPos ptPress.X, ptPress.Y
>>     percent = 100*((ptPress.X-VAS_SliderDummy.Left)/sw)
>>     score=CInt(percent)/10
>>     ...
>>     and then display "score"
>>
>> but then it would display something like "7.500121245" instead of just
>> "7.5"
>> how can i format the score so that it shows to 1 or 2 decimal places?
>>
>> thank you
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "E-Prime" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to e-prime+unsubscribe at googlegroups.com.
>>
>> To post to this group, send email to e-prime at googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/e-prime/84487198-c5d1-49b3-8e8d-268eee77b9f2%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "E-Prime" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/e-prime/YkmFEvxOlxA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> e-prime+unsubscribe at googlegroups.com.
> To post to this group, send email to e-prime at googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/e-prime/CAKAdR-sze1ksMEJTWbTsxOY3TNtzW2YhiAffeRRekXAkMcazyw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/CAGHpV7zgd8iZ4YChoKvyFu-urWP8Q8C%2BGXGSNSxtdUBip5kBjw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20130917/fb8ab640/attachment.htm>


More information about the Eprime mailing list