ZScript π
Moderator: GZDoom Developers
- Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
- Contact:
ZScript π
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
- 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
- Contact:
Re: ZScript π
You could, perhaps, define it as a constant whose value is the result of 22/7.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49225
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript π
const pi = 3.1415926535897932384626433832795;
Re: ZScript π
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.
- kevansevans
- Spotlight Team
- Posts: 430
- Joined: Tue Oct 05, 2010 12:04 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: ZScript π
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.Graf Zahl wrote:const pi = 3.1415926535897932384626433832795;
Most languages have this built into their standard math lib anyways, no harm adding it to ZScript.