AngouriMath

Navigation

ShaderSource


← Back to list of classes

Description

Summary

Prints expressions as straight-line shader code: one statement per output, with every
subexpression that occurs more than once computed once into a local.

Remarks

The code computes what Compile<double, …> computes, the real-valued
reading: where the library's value is not real, the shader's is NaN or
unspecified, as the shading language's own pow and sqrt leave it. A
node with no faithful form in that reading — a complex constant, a set, a rounding
rule whose tie-breaking the languages do not agree on — is declined, naming the node,
rather than printed as something close. What Compile refuses is declined with
the message Compile gives.
Every expression is checked before anything is printed, so that printing has nothing
left to decline: the check is Refusal(AngouriMath.Entity), and Print(AngouriMath.Entity) prints
exactly the nodes it accepts.
Integer powers are multiplied out up to the fourth, and above that taken as
pow(abs(x), n) with the sign restored for an odd n: pow of a
negative base is undefined in both HLSL and GLSL, while x^5 is defined for every
real x. A rational power with an odd denominator below ten is the real root
of a negative base, as Compile takes it, and is printed the same way.

Members

























Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6003 pages online