ZScript π

Moderator: GZDoom Developers

User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm

ZScript π

Post by Arctangent »

there is something deeply distressing about the fact that zscript would flunk out of high school due to being unable to calculate the circumference of a circle
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed

Re: ZScript π

Post by wildweasel »

You could, perhaps, define it as a constant whose value is the result of 22/7.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49117
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript π

Post by Graf Zahl »

const pi = 3.1415926535897932384626433832795;
User avatar
3saster
Posts: 199
Joined: Fri May 11, 2018 2:39 pm
Location: Canada

Re: ZScript π

Post by 3saster »

I think in addition to properly exposing Pi natively in ZScript, it would be good to somehow expose/implement radian argument trigonometric functions as well.
User avatar
kevansevans
Spotlight Team
Posts: 423
Joined: Tue Oct 05, 2010 12:04 am
Graphics Processor: nVidia with Vulkan support

Re: ZScript π

Post by kevansevans »

Graf Zahl wrote:const pi = 3.1415926535897932384626433832795;
Wouldn't this open up potential conflict of multiple mods using their own definition of pi? I'd be really annoyed if my mods didn't work because I didn't use the same magic number as a different mod I was trying to replicate.

Most languages have this built into their standard math lib anyways, no harm adding it to ZScript.
User avatar
m8f
 
 
Posts: 1446
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)

Re: ZScript π

Post by m8f »

Return to “Closed Feature Suggestions [GZDoom]”