Powerdraw is a free drafting program.

It has a macro facility based on Pascal but it has no trigonometric functions and no square root, etc.
So, this
file has some notes (and actual complete programs as .cmf) on horizontal, vertical, and
vertical decliner dial programs, and meridian and polar dials, and a calendar (declination) curve
generator for any SH from 23 to 80 degrees. This zip file is complete with trigonometric methods,
and issues found in Powerdraw. The functions sin, cos, tan, and sqrt work for all ranges, the arc
functions (asn, acs, atan) also.
Documentation is marginal for Powerdraw, the notes and the hDial, vDial, pDial, mDial, and vDec
are good sources for "programming by example" should you wish to play with Powerdraw.

The functions good for all negative and positive values, are in:-

Polar dial
Calendar curves for a specific SH, the whole
being aligned on a dial's SD or substyle.
Meridian dials on one layout
Also consider FreeCAD and also
NanoCAD both of which are free
All my macros and programs are
free for NanoCAD, FreeCAD,
and DeltaCAD
download Programming
Shadows, it is free, and has
many hints to get you up to
speed on many languages