[ACS] Int(), Floor(), Ceil()

Moderator: GZDoom Developers

Post Reply
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

[ACS] Int(), Floor(), Ceil()

Post by NeuralStunner »

For Fixed numbers, truncates the fractional portion by rounding to nearest, down, or up (respectively). Currently the only options to do this involve mucking about with bit shifting/masking and checks. A built-in would be less messy.

Note: I'm a bit torn on the name "Int()" since it still returns fixed-point, which is potential confusion. Is there a better name for this?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [ACS] Int(), Floor(), Ceil()

Post by Graf Zahl »

What you want is clearly 'round()'.
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: [ACS] Int(), Floor(), Ceil()

Post by NeuralStunner »

That could work. (Or are you suggesting having a single function for all three operations? If pcode bloat is a concern, I'm all for that.)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [ACS] Int(), Floor(), Ceil()

Post by Graf Zahl »

added
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”