[Added] ZScript π

Moderator: GZDoom Developers

ZScript π

Postby Arctangent » Fri Jan 22, 2021 1:23 am

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
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371

Re: ZScript π

Postby wildweasel » Fri Jan 22, 2021 1:31 am

You could, perhaps, define it as a constant whose value is the result of 22/7.
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: ZScript π

Postby Graf Zahl » Fri Jan 22, 2021 1:41 am

const pi = 3.1415926535897932384626433832795;
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript π

Postby 3saster » Fri Jan 22, 2021 6:30 am

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
3saster
 
Joined: 11 May 2018
Location: Canada

Re: ZScript π

Postby kevansevans » Mon Jan 25, 2021 11:02 pm

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
kevansevans
Disciple of The Great God Imp
Spotlight Team
 
Joined: 05 Oct 2010
Github ID: kevansevans
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: ZScript π

Postby m8f » Sat Feb 13, 2021 12:52 pm

User avatar
m8f
dreamer
 
 
 
Joined: 29 Dec 2017
Location: Siberia (UTC+7)
Discord: m8f#0629
Github ID: mmaulwurff
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests