--- title: "Standard Library Reference" draft: false ---

## Operators

Name | Description | Argument Types | Return Type
--- | --- | --- | ---
!= | Inequality operator. Compare two values and return true if they are different. | Int, Int | Bool
Float, Float | Bool
Complex, Complex | Bool
Bool, Bool | Bool
% | Modulus operator. Computes the remainder when x is divided by y. Not to be confused with the complex modulus. | Int, Int | Int
Float, Float | Float
&& | Logical AND. | Bool, Bool | Bool
* | Multiplication operator. | Int, Int | Int
Float, Float | Float
Complex, Complex | Complex
Hyper, Hyper | Hyper
Hyper, Float | Hyper
Color, Float | Color
+ | Adds two numbers together. | Int, Int | Int
Float, Float | Float
Complex, Complex | Complex
Hyper, Hyper | Hyper
Color, Color | Color
- | Subtracts two numbers | Int, Int | Int
Float, Float | Float
Complex, Complex | Complex
Hyper, Hyper | Hyper
Color, Color | Color
/ | Division operator | Float, Float | Float
Complex, Float | Complex
Complex, Complex | Complex
Hyper, Float | Hyper
Color, Float | Color
< | Less-than operator. Compare two values and return true if the first is less than the second. | Int, Int | Bool
Float, Float | Bool
Complex, Complex | Bool
<= | Less-than-or-equal operator. Compare two values and return true if the first is less than or equal to the second. | Int, Int | Bool
Float, Float | Bool
Complex, Complex | Bool
== | Equality operator. Compare two values and return true if they are the same. | Int, Int | Bool
Float, Float | Bool
Complex, Complex | Bool
Bool, Bool | Bool
> | Greater-than operator. Compare two values and return true if the first is greater than the second. | Int, Int | Bool
Float, Float | Bool
Complex, Complex | Bool
>= | Greater-than-or-equal operator. Compare two values and return true if the first is greater than or equal to the second. | Int, Int | Bool
Float, Float | Bool
Complex, Complex | Bool
^ | Exponentiation operator. Computes x to the power y. | Float, Float | Float
Complex, Float | Complex
Complex, Complex | Complex
not | Logical NOT. | Bool | Bool
|| | Logical OR. | Bool, Bool | Bool

## Functions

Name | Description | Argument Types | Return Type
--- | --- | --- | ---
#rand | Each time this is accessed, it returns a new pseudo-random complex number. This is primarily for backwards compatibility with Fractint formulas - use the random() function in new formulas. |  | Complex
#random | Each time this is accessed, it returns a new pseudo-random complex number. This is primarily for backwards compatibility with Fractint formulas - use the random() function in new formulas. |  | Complex
@fn1 | Predefined function parameter used by Fractint formulas | Complex | Complex
@fn2 | Predefined function parameter used by Fractint formulas | Complex | Complex
@fn3 | Predefined function parameter used by Fractint formulas | Complex | Complex
@fn4 | Predefined function parameter used by Fractint formulas | Complex | Complex
abs | The absolute value of a number. abs(3) = abs(-3) = 3. abs() of a complex number is a complex number consisting of the absolute values of the real and imaginary parts, i.e. abs(a,b) = (abs(a),abs(b)). | Int | Int
Float | Float
Complex | Complex
acos | Inverse cosine function. | Float | Float
Complex | Complex
Hyper | Hyper
acosh | Inverse hyperbolic cosine function. | Float | Float
Complex | Complex
Hyper | Hyper
alpha | The alpha component of a color. Can be assigned to. | Color | Float
asin | Inverse sine function. | Float | Float
Complex | Complex
Hyper | Hyper
asinh | Inverse hyperbolic sine function. | Float | Float
Complex | Complex
Hyper | Hyper
atan | Inverse tangent function. | Float | Float
Complex | Complex
Hyper | Hyper
atan2 | The angle between this complex number and the real line, aka the complex argument. | Complex | Float
atanh | Inverse hyperbolic tangent function. | Float | Float
Complex | Complex
Hyper | Hyper
blend | Blend two colors together in the ratio given by the 3rd parameter. | Color, Color, Float | Color
blue | The blue component of a color. Can be assigned to. | Color | Float
bool | Construct a boolean. It's not really required (bool x = bool(true) is just the same as bool x = true) but is included for consistency. | Bool | Bool
cabs | The complex modulus of a complex number z. cabs(a,b) is equivalent to sqrt(a*a+b*b). This is also the same as sqrt(|z|) | Complex | Float
ceil | Round up to the next highest number. | Float | Int
Complex | Complex
cmag | The squared modulus of a complex or hypercomplex number z. cmag(a,b) is equivalent to a*a+b*b. This is the same as |z|. | Complex | Float
Hyper | Float
color | Constructs a new color from floating point red, green, blue and alpha components. Equivalent to rgba. | Float, Float, Float, Float | Color
complex | Construct a complex number from two real parts. complex(a,b) is equivalent to (a,b). | Float, Float | Complex
compose | Composite the second color on top of the first, with opacity given by the 3rd parameter. | Color, Color, Float | Color
conj | The complex conjugate. conj(a,b) is equivalent to (a,-b). | Complex | Complex
Hyper | Hyper
cos | trigonometric sine function. | Float | Float
Complex | Complex
Hyper | Hyper
cosh | Hyperbolic cosine function. | Float | Float
Complex | Complex
Hyper | Hyper
cosxx | Incorrect version of cosine function. Provided for backwards compatibility with equivalent wrong function in Fractint. | Complex | Complex
Hyper | Hyper
cotan | Trigonometric cotangent function. | Float | Float
Complex | Complex
Hyper | Hyper
cotanh | Hyperbolic cotangent function. | Float | Float
Complex | Complex
Hyper | Hyper
exp | exp(x) is equivalent to e^x | Float | Float
Complex | Complex
Hyper | Hyper
flip | Swap the real and imaginary parts of a complex number. flip(a,b) = (b,a). | Complex | Complex
Hyper | Hyper
float | Construct a floating-point number. | Float | Float
floor | Round down to the next lowest number. | Float | Int
Complex | Complex
fn1 | Predefined function parameter used by Fractint formulas | Complex | Complex
fn2 | Predefined function parameter used by Fractint formulas | Complex | Complex
fn3 | Predefined function parameter used by Fractint formulas | Complex | Complex
fn4 | Predefined function parameter used by Fractint formulas | Complex | Complex
gradient | Look up a color from the default gradient. | Float | Color
green | The green component of a color. Can be assigned to. | Color | Float
hsl | Create a color from hue, saturation and lightness components. The alpha channel is set to to 1.0 (=100%). | Float, Float, Float | Color
hsla | Create a color from hue, saturation and lightness components and an alpha channel. | Float, Float, Float, Float | Color
hsv | Create a color from hue, saturation and value components. HSV is a similar color model to HSL but has a different valid range for brightness. | Float, Float, Float | Color
hue | The hue of a color. | Color | Float
hyper | Construct a hypercomplex number with a real and 3 imaginary parts. Can be passed either 2 complex numbers or 4 floating-point numbers. hyper(a,b,c,d) is equivalent to the shorthand (a,b,c,d). | Float, Float, Float, Float | Hyper
Complex, Complex | Hyper
hyper_j | The 3rd component of a hypercomplex number. Can be assigned to. hyper_j(a,b,c,d) = c. | Hyper | Float
hyper_jk | The 3rd and 4th parts of a hypercomplex number. Can be assigned to. hyper_jk(a,b,c,d) = (c,d). | Hyper | Complex
hyper_k | The 4th component of a hypercomplex number. Can be assigned to. hyper_k(a,b,c,d) = d. | Hyper | Float
hyper_ri | The real and imaginary parts of a hypercomplex number. Can be assigned to. hyper_ri(a,b,c,d) = (a,b). | Hyper | Complex
ident | Do nothing. ident(x) is equivalent to x. This function is useless in normal formulas but comes in useful as a value for a function parameter to a formula. For example, a general formula like z = @fn1(z*z)+c can be set back to a plain Mandelbrot by setting fn1 to ident. Note: ident() is compiled out so there's no speed penalty involved. | Int | Int
Float | Float
Complex | Complex
Bool | Bool
Hyper | Hyper
imag | Extract the imaginary part of a complex or hypercomplex number. imag(a,b) = b. imag() is unusual in that it can be assigned to: imag(z) = 7 changes the imag part of z. | Complex | Float
Hyper | Float
imag2 | The square of the imaginary part of a complex number. real2(a,b) = b*b. While not a generally useful function, this is provided to ease porting of files from older Gnofract 4D versions. | Complex | Float
int | Construct an integer. To convert a float to an int, use floor, ceil, round or trunc instead. | Int | Int
log | The natural log. | Float | Float
Complex | Complex
Hyper | Hyper
lum | The luminance (or brightness) of a color. | Color | Float
manhattan | The Manhattan distance between the origin and complex number z. manhattan(a,b) is equivalent to abs(a) + abs(b). | Complex | Float
manhattanish | A variant on Manhattan distance provided for backwards compatibility. manhattanish(a,b) is equivalent to a+b. | Complex | Float
manhattanish2 | A variant on Manhattan distance provided for backwards compatibility. manhattanish2(a,b) is equivalent to (a*a + b*b)^2. | Complex | Float
max | Returns the larger of its two arguments. | Float, Float | Float
max2 | max2(a,b) returns the larger of a*a or b*b. Provided for backwards compatibility. | Complex | Float
mergemultiply | Multiplies colors together. Result is always darker than either input. | Color, Color | Color
mergenormal | Returns second color, ignoring first. | Color, Color | Color
min | Returns the smaller of its two arguments. | Float, Float | Float
min2 | min2(a,b) returns the smaller of a*a or b*b. Provided for backwards compatibility. | Complex | Float
neg | No documentation yet. | Int | Int
Float | Float
Complex | Complex
Hyper | Hyper
rand | Each time this is accessed, it returns a new pseudo-random complex number. This is primarily for backwards compatibility with Fractint formulas - use the random() function in new formulas. |  | Complex
real | Extract the real part of a complex or hypercomplex number. real(a,b) = a. real() is unusual in that it can be assigned to: real(z) = 7 changes the real part of z. | Complex | Float
Hyper | Float
real2 | The square of the real part of a complex number. real2(a,b) = a*a. While not a generally useful function, this is provided to ease porting of files from older Gnofract 4D versions. | Complex | Float
recip | The reciprocal of a number. recip(x) is equivalent to 1/x. Note that not all hypercomplex numbers have a proper reciprocal. | Float | Float
Complex | Complex
Hyper | Hyper
red | The red component of a color. Can be assigned to. | Color | Float
rgb | Create a color from three color components. The alpha channel is set to to 1.0 (=100%). | Float, Float, Float | Color
rgba | Create a color from three color components and an alpha channel. | Float, Float, Float, Float | Color
round | Round to the nearest number (0.5 rounds up). | Float | Int
Complex | Complex
sat | The saturation of a color. | Color | Float
sin | trigonometric sine function. | Float | Float
Complex | Complex
Hyper | Hyper
sinh | Hyperbolic sine function. | Float | Float
Complex | Complex
Hyper | Hyper
sqr | Square the argument. sqr(x) is equivalent to x*x or x^2. | Int | Int
Float | Float
Complex | Complex
Hyper | Hyper
sqrt | The square root. The square root of a negative float number is NaN (ie it is NOT converted to complex). Thus sqrt((-3,0)) != sqrt(-3). | Float | Float
Complex | Complex
Hyper | Hyper
tan | trigonometric sine function. | Float | Float
Complex | Complex
Hyper | Hyper
tanh | Hyperbolic tangent function. | Float | Float
Complex | Complex
Hyper | Hyper
trunc | Round towards zero. | Float | Int
Complex | Complex
zero | Returns zero. | Int | Int
Float | Float
Complex | Complex

## Symbols

Name | Description | Argument Types | Return Type
--- | --- | --- | ---
#center | Where the center of the image is located on the complex plane | Complex
#color | Set this from a coloring function to directly set the color instead of using a gradient | Color
#fate | The fate of a point can be used to distinguish between different basins of attraction or whatever you like. Set this to a number from 2 to 128 to indicate that a different 'fate' has befallen this point. 0 indicates the point has diverged, 1 that it has been trapped, >1 whatever you like. Can only be usefully updated in the #final section. | Int
#index | The point in the gradient to use for the color of this point. | Float
#inside | Set this in the final section of a formula to override whether a point is colored with the inside or outside coloring algorithm. This is mainly useful in conjuction with #fate. | Bool
#magn | The magnification factor of the image. This is the number of times the image size has doubled, or ln(4.0/size) | Float
#maxit | No documentation yet. | Int
#maxiter | No documentation yet. | Int
#numiter | The number of iterations performed. | Int
#pi | The constant pi, 3.14159... | Float
#pixel | The (X,Y) coordinates of the current point. When viewing the Mandelbrot set, this has a different value for each pixel. When viewing the Julia set, it remains constant for each pixel. | Complex
#solid | Set this to true in a coloring function to use the solid color rather than the color map. | Bool
#tolerance | 10% of the distance between adjacent pixels. | Float
#xypixel | The (X,Y) coordinates of the current point. When viewing the Mandelbrot set, this has a different value for each pixel. When viewing the Julia set, it remains constant for each pixel. | Complex
#z | No documentation yet. | Complex
#zwpixel | The (Z,W) coordinates of the current point. (See #pixel for the other two coordinates.) When viewing the Mandelbrot set, this remains constant for each pixel on the screen; when viewing the Julia set, it's different for each pixel. Initialize z to some function of this to take advantage of 4D drawing. | Complex
@p1 | Predefined parameter used by Fractint formulas | Complex
@p2 | Predefined parameter used by Fractint formulas | Complex
@p3 | Predefined parameter used by Fractint formulas | Complex
@p4 | Predefined parameter used by Fractint formulas | Complex
@p5 | Predefined parameter used by Fractint formulas | Complex
@p6 | Predefined parameter used by Fractint formulas | Complex
maxit | No documentation yet. | Int
maxiter | No documentation yet. | Int
p1 | Predefined parameter used by Fractint formulas | Complex
p2 | Predefined parameter used by Fractint formulas | Complex
p3 | Predefined parameter used by Fractint formulas | Complex
p4 | Predefined parameter used by Fractint formulas | Complex
p5 | Predefined parameter used by Fractint formulas | Complex
p6 | Predefined parameter used by Fractint formulas | Complex
pi | The constant pi, 3.14159... | Float
pixel | The (X,Y) coordinates of the current point. When viewing the Mandelbrot set, this has a different value for each pixel. When viewing the Julia set, it remains constant for each pixel. | Complex
z | No documentation yet. | Complex