Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> In MMF2, rounding numbers
United States
Glukom
Posted: Sep 27 2009, 01:36 PM
Quote Post


OFF TO JOIN THE NAVY
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 4071
Member No.: 2455
Joined: 6-August 06

Status: (0d) [--]


Is there a way to make numbers (specifically decimals) round up or down automatically?

Like, lets say after doing an attack, the total damage is 55.7, but I want that to mean 56. Could I do that?

edit: thanks for moving this actually

This post has been edited by Glukom on Sep 27 2009, 01:58 PM


--------------------
EVERYBODY WHO READS THIS AND DISLIKES THE DIRECTION OF NEW MFGG





i feel your pain :[
PMEmail PosterMSN
Top
United States
Xgoff
Posted: Sep 27 2009, 02:03 PM
Quote Post


<):|
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 52341
Member No.: 24
Joined: 13-October 03

Status: (0d) [--]


ceil() rounds up

floor() rounds down

int() rounds down but also converts the number into an integer which will probably **** stuff up for you


--------------------

This post may contain original research or unverified claims.
Please disregard the above information and contact an administrator.

DISCLAIMER: by sending me (xgoff) a private message, you agree to the directives and their terms specified henceforth:
DIRECTIVE 1 (APPLE): i may or may not reply promptly or at all; and there are no guarantees to the usefulness of the reply. i may not acknowledge whether i have even received your private message
DIRECTIVE 2 (CHILE CON CARNE): as per my view, "private" applies only to the initial transaction, and the material of your message may or may not be made public at my discretion; as this will more than likely be a post in the CCC or IRC, you may not be able to view it
DIRECTIVE 3 (FEATHER DUSTER): you must address me (xgoff) as "Sir Master Xgofficus his Highest and Most Awesome the Third"; failure to comply with this term may invoke one or both of the above directives, and i will leave a burning bag of **** on your doorstep
DIRECTIVE 4 (BOOTSTRAP): if you have read this disclaimer, please private message me promptly, in compliance with the above terms, so i can ensure you are capable of following directions you idiot
this concludes the test of the emergency disclaimer system, your scheduled programming will now continue. satisfaction guaranteed, and 100% cash back available under certain circumstances; restrictions may or may not apply within your place of residence
NOTICE: these directives and their terms may change at any time, without notice; as a private message transaction to myself assumes an understanding and full compliance of the above, you should ensure you are fully aware of the above terms at any point before sending a private message; any message received is assumed to have been sent in compliance with the above

QUOTE
(5:25:58 PM) Mikau: xgoff
(5:26:00 PM) Mikau: guess what
(5:26:04 PM) Xgoff: chicken butt
(5:26:09 PM) Mikau: **** you
PMEmail PosterUsers WebsiteAOLMSN
Top
United States
Glukom
Posted: Sep 27 2009, 02:14 PM
Quote Post


OFF TO JOIN THE NAVY
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 4071
Member No.: 2455
Joined: 6-August 06

Status: (0d) [--]


QUOTE (Xgoff @ Sep 27 2009, 03:03 PM)
ceil() rounds up

floor() rounds down

int() rounds down but also converts the number into an integer which will probably xgoff stuff up for you

So this would work for decimals, then? Like, it won't round 55 up to 60, but it would round 55.5 up to 56?


--------------------
EVERYBODY WHO READS THIS AND DISLIKES THE DIRECTION OF NEW MFGG





i feel your pain :[
PMEmail PosterMSN
Top
United States
Xgoff
Posted: Sep 27 2009, 02:16 PM
Quote Post


<):|
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 52341
Member No.: 24
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Glukom @ Sep 27 2009, 01:14 PM)
So this would work for decimals, then? Like, it won't round 55 up to 60, but it would round 55.5 up to 56?

yeah just decimals

if you ever needed to round eg 55 to 60 you'd have to do something like:

ceil(55 / 10.0) * 10.0


--------------------

This post may contain original research or unverified claims.
Please disregard the above information and contact an administrator.

DISCLAIMER: by sending me (xgoff) a private message, you agree to the directives and their terms specified henceforth:
DIRECTIVE 1 (APPLE): i may or may not reply promptly or at all; and there are no guarantees to the usefulness of the reply. i may not acknowledge whether i have even received your private message
DIRECTIVE 2 (CHILE CON CARNE): as per my view, "private" applies only to the initial transaction, and the material of your message may or may not be made public at my discretion; as this will more than likely be a post in the CCC or IRC, you may not be able to view it
DIRECTIVE 3 (FEATHER DUSTER): you must address me (xgoff) as "Sir Master Xgofficus his Highest and Most Awesome the Third"; failure to comply with this term may invoke one or both of the above directives, and i will leave a burning bag of **** on your doorstep
DIRECTIVE 4 (BOOTSTRAP): if you have read this disclaimer, please private message me promptly, in compliance with the above terms, so i can ensure you are capable of following directions you idiot
this concludes the test of the emergency disclaimer system, your scheduled programming will now continue. satisfaction guaranteed, and 100% cash back available under certain circumstances; restrictions may or may not apply within your place of residence
NOTICE: these directives and their terms may change at any time, without notice; as a private message transaction to myself assumes an understanding and full compliance of the above, you should ensure you are fully aware of the above terms at any point before sending a private message; any message received is assumed to have been sent in compliance with the above

QUOTE
(5:25:58 PM) Mikau: xgoff
(5:26:00 PM) Mikau: guess what
(5:26:04 PM) Xgoff: chicken butt
(5:26:09 PM) Mikau: **** you
PMEmail PosterUsers WebsiteAOLMSN
Top
United States
RetroXYZ
Posted: Sep 27 2009, 02:16 PM
Quote Post


Standard Member
[*][*]

Group Icon
Group: Members
Posts: 2714
Member No.: 4325
Joined: 27-August 07

Status: (0d) [--]


QUOTE (Xgoff @ Sep 27 2009, 03:03 PM)
ceil() rounds up

floor() rounds down

Might I also mention that up means higher and down means lower

as in:

floor(5.4) = 5
floor(-5.4) = -6
ceil(5.4) = 6
ceil(-5.4) = -5
PMEmail PosterMSN
Top
United States
Xgoff
Posted: Sep 27 2009, 02:21 PM
Quote Post


<):|
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 52341
Member No.: 24
Joined: 13-October 03

Status: (0d) [--]


QUOTE (RetroXYZ @ Sep 27 2009, 01:16 PM)
Might I also mention that up means higher and down means lower

as in:

floor(5.4) = 5
floor(-5.4) = -6
ceil(5.4) = 6
ceil(-5.4) = -5

yeah then well:

floor() rounds towards negative infinity and ceil() rounds towards positive infinity

also i was slightly inaccurate with int(); it just chops the fractional part off. so when working with negatives it isn't the same as floor(), it's the same as ceil() (apart from converting it to a true integer), so int() rounds towards 0

This post has been edited by Xgoff on Sep 27 2009, 02:21 PM


--------------------

This post may contain original research or unverified claims.
Please disregard the above information and contact an administrator.

DISCLAIMER: by sending me (xgoff) a private message, you agree to the directives and their terms specified henceforth:
DIRECTIVE 1 (APPLE): i may or may not reply promptly or at all; and there are no guarantees to the usefulness of the reply. i may not acknowledge whether i have even received your private message
DIRECTIVE 2 (CHILE CON CARNE): as per my view, "private" applies only to the initial transaction, and the material of your message may or may not be made public at my discretion; as this will more than likely be a post in the CCC or IRC, you may not be able to view it
DIRECTIVE 3 (FEATHER DUSTER): you must address me (xgoff) as "Sir Master Xgofficus his Highest and Most Awesome the Third"; failure to comply with this term may invoke one or both of the above directives, and i will leave a burning bag of **** on your doorstep
DIRECTIVE 4 (BOOTSTRAP): if you have read this disclaimer, please private message me promptly, in compliance with the above terms, so i can ensure you are capable of following directions you idiot
this concludes the test of the emergency disclaimer system, your scheduled programming will now continue. satisfaction guaranteed, and 100% cash back available under certain circumstances; restrictions may or may not apply within your place of residence
NOTICE: these directives and their terms may change at any time, without notice; as a private message transaction to myself assumes an understanding and full compliance of the above, you should ensure you are fully aware of the above terms at any point before sending a private message; any message received is assumed to have been sent in compliance with the above

QUOTE
(5:25:58 PM) Mikau: xgoff
(5:26:00 PM) Mikau: guess what
(5:26:04 PM) Xgoff: chicken butt
(5:26:09 PM) Mikau: **** you
PMEmail PosterUsers WebsiteAOLMSN
Top
United States
Glukom
Posted: Sep 27 2009, 02:34 PM
Quote Post


OFF TO JOIN THE NAVY
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 4071
Member No.: 2455
Joined: 6-August 06

Status: (0d) [--]


Alright, thanks


--------------------
EVERYBODY WHO READS THIS AND DISLIKES THE DIRECTION OF NEW MFGG





i feel your pain :[
PMEmail PosterMSN
Top
United States
Baroque
Posted: Sep 27 2009, 05:57 PM
Quote Post





Group Icon
Group: Members
Posts: 817
Member No.: 6076
Joined: 11-March 09

Status: (0d) [--]


QUOTE (Xgoff @ Sep 27 2009, 11:21 AM)

also i was slightly inaccurate with int(); it just chops the fractional part off. so when working with negatives it isn't the same as floor(), it's the same as ceil() (apart from converting it to a true integer), so int() rounds towards 0

translation:

int() truncates


--------------------


DeviantArt (DA needs update) | Clean FurAffinity Clean FA | Why I Cut Quotes
You see things, and you ask, 'Why?' But I dream things that never were, and I ask, 'Why not?'


QUOTE (Ryo)
its the correct form of to.........lemme run it down for ya

to is used when your talking about the number. good way to remember this: to has to letters

too is used when your talkin about actions in stuff.

two is used when your talking about places and locations
PMEmail PosterAOL
Top
United States
Glukom
Posted: Sep 27 2009, 06:11 PM
Quote Post


OFF TO JOIN THE NAVY
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 4071
Member No.: 2455
Joined: 6-August 06

Status: (0d) [--]


hey thanks for posting here draco now i don't have to double post


Ok, so, exponents. How do I do those. Using ^ didn't work, so what will?


--------------------
EVERYBODY WHO READS THIS AND DISLIKES THE DIRECTION OF NEW MFGG





i feel your pain :[
PMEmail PosterMSN
Top
United States
Baroque
Posted: Sep 27 2009, 06:20 PM
Quote Post





Group Icon
Group: Members
Posts: 817
Member No.: 6076
Joined: 11-March 09

Status: (0d) [--]


QUOTE (Glukom @ Sep 27 2009, 03:11 PM)
hey thanks for posting here draco now i don't have to double post


Ok, so, exponents. How do I do those. Using ^ didn't work, so what will?

MMF2 is a piece of **** and has no quick exponent operator

use one of the math extensions and use their raise a number to a power function


--------------------


DeviantArt (DA needs update) | Clean FurAffinity Clean FA | Why I Cut Quotes
You see things, and you ask, 'Why?' But I dream things that never were, and I ask, 'Why not?'


QUOTE (Ryo)
its the correct form of to.........lemme run it down for ya

to is used when your talking about the number. good way to remember this: to has to letters

too is used when your talkin about actions in stuff.

two is used when your talking about places and locations
PMEmail PosterAOL
Top
United States
Glukom
Posted: Sep 27 2009, 06:33 PM
Quote Post


OFF TO JOIN THE NAVY
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 4071
Member No.: 2455
Joined: 6-August 06

Status: (0d) [--]


QUOTE (Baroque @ Sep 27 2009, 07:20 PM)
MMF2 is a piece of **** and has no quick exponent operator

use one of the math extensions and use their raise a number to a power function

are you serious sdfsdgdgsdgdfg

and that sucks because i really need an exponent here


Which extension should I use


--------------------
EVERYBODY WHO READS THIS AND DISLIKES THE DIRECTION OF NEW MFGG





i feel your pain :[
PMEmail PosterMSN
Top
United States
Xgoff
Posted: Sep 27 2009, 08:09 PM
Quote Post


<):|
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 52341
Member No.: 24
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Glukom @ Sep 27 2009, 05:11 PM)
Ok, so, exponents. How do I do those. Using ^ didn't work, so what will?

'pow'

without the quotes

so something like

3 pow 4

or whatever

EDIT: btw you might want to keep this page handy (may help draco too)

This post has been edited by Xgoff on Sep 27 2009, 08:16 PM


--------------------

This post may contain original research or unverified claims.
Please disregard the above information and contact an administrator.

DISCLAIMER: by sending me (xgoff) a private message, you agree to the directives and their terms specified henceforth:
DIRECTIVE 1 (APPLE): i may or may not reply promptly or at all; and there are no guarantees to the usefulness of the reply. i may not acknowledge whether i have even received your private message
DIRECTIVE 2 (CHILE CON CARNE): as per my view, "private" applies only to the initial transaction, and the material of your message may or may not be made public at my discretion; as this will more than likely be a post in the CCC or IRC, you may not be able to view it
DIRECTIVE 3 (FEATHER DUSTER): you must address me (xgoff) as "Sir Master Xgofficus his Highest and Most Awesome the Third"; failure to comply with this term may invoke one or both of the above directives, and i will leave a burning bag of **** on your doorstep
DIRECTIVE 4 (BOOTSTRAP): if you have read this disclaimer, please private message me promptly, in compliance with the above terms, so i can ensure you are capable of following directions you idiot
this concludes the test of the emergency disclaimer system, your scheduled programming will now continue. satisfaction guaranteed, and 100% cash back available under certain circumstances; restrictions may or may not apply within your place of residence
NOTICE: these directives and their terms may change at any time, without notice; as a private message transaction to myself assumes an understanding and full compliance of the above, you should ensure you are fully aware of the above terms at any point before sending a private message; any message received is assumed to have been sent in compliance with the above

QUOTE
(5:25:58 PM) Mikau: xgoff
(5:26:00 PM) Mikau: guess what
(5:26:04 PM) Xgoff: chicken butt
(5:26:09 PM) Mikau: **** you
PMEmail PosterUsers WebsiteAOLMSN
Top
United States
Glukom
Posted: Sep 27 2009, 08:40 PM
Quote Post


OFF TO JOIN THE NAVY
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 4071
Member No.: 2455
Joined: 6-August 06

Status: (0d) [--]


QUOTE (Xgoff @ Sep 27 2009, 09:09 PM)
'pow'

without the quotes

so something like

3 pow 4

or whatever

EDIT: btw you might want to keep this page handy (may help draco too)

Thanks, worked great.

And thanks for that link too, who knew MFGG wiki could be that helpful


--------------------
EVERYBODY WHO READS THIS AND DISLIKES THE DIRECTION OF NEW MFGG





i feel your pain :[
PMEmail PosterMSN
Top
United States
RetroXYZ
Posted: Sep 27 2009, 09:32 PM
Quote Post


Standard Member
[*][*]

Group Icon
Group: Members
Posts: 2714
Member No.: 4325
Joined: 27-August 07

Status: (0d) [--]


QUOTE (Baroque @ Sep 27 2009, 07:20 PM)
MMF2 is a piece of **** and has no quick exponent operator

For future reference, no languages do unless they're the crappy kind.

^ is almost always XOR, which is a logic operator for exclusive or:
true ^ true = false
true ^ false = true
false ^ true = true
false ^ false = false
PMEmail PosterMSN
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0761 ]   [ 13 queries used ]   [ GZIP Enabled ]   [ Server Load: 0.70 ]