Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 5:53 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: round a number to 1 decimal
PostPosted: May 17th, 2017, 8:43 pm 
Offline

Joined: August 5th, 2010, 1:42 pm
Posts: 109
Opus: Creator v9 Opus v7
OS: windows
Hi,
how can I round a number in a constant expresion like this?
(SCORE_CORRECT*10)/24
I would like to see the number rounded to 1 decimal, so if the score is (16*10)/24=6.6666... to see only 6.6
I think is it something with Math.round but not a clue.
Thank you


For this message Isma has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: round a number to 1 decimal
PostPosted: May 18th, 2017, 11:54 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
myAnswer = (SCORE_CORRECT*10)/24

Simple decimal place rounding:
Code:
Math.round(myAnswer * 10) / 10


<mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group