Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 11:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Help with a maths query if possible?
PostPosted: May 22nd, 2008, 3:33 pm 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
Hi folks, long time no use but I have been back to Opus in the last few days and I'm trying to do something but I'm lost.

I want to take a number, divide it by another number then use math.floor to round it down.

What i need to be able to do is use the figure that was remaining from the rounded down number and use it as a variable. Can it be done?

I enclose an imp for you to see what i mean.

Thanks

Opus 6, winxp


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro 6 on Windows 2000 with 2gb Ram
Working on a large intranet!


Top
 Profile  
 
 Post subject:
PostPosted: May 22nd, 2008, 5:29 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Use the modulo operator (%);

IE 5 % 2 = 1

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  
 
 Post subject:
PostPosted: May 23rd, 2008, 11:50 am 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
Could you elaborate Mack?

Maybe The hangover I have isnt helping right enough :lol:

_________________
Opus Pro 6 on Windows 2000 with 2gb Ram
Working on a large intranet!


Top
 Profile  
 
 Post subject:
PostPosted: May 23rd, 2008, 12:22 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Depends what you need. Using your values:

968 % 60 = 8

If however, you were looking for the remainder after the decimal from

968 / 60 = 16.13333333

Then some simple logic will suffice:

use:

myAnswer = (968 / 60) - Math.floor(968 / 60)

which basically means that you are subtracting 16 from 16.13333

Hope that helps,

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  
 
 Post subject:
PostPosted: May 26th, 2008, 3:25 pm 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
thanks Mack, the simple logic was the answer I had been trying to get. I'm kicking myself for not getting something so simple!!

thanks

_________________
Opus Pro 6 on Windows 2000 with 2gb Ram
Working on a large intranet!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 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