Format: FRED.SIN dest1, dest2, destPred, iterationCount, source1, source2

FRED.COS dest1, dest2, predicate, iterationCount, source1, source2.

Phase0: FRED.SIN{.part} W0, W1, (P0|_), iterationCount, S0{.NEG}{.ABS}, (S3|_)

FRED.COS{.part} W0, W1, (P0|_), iterationCount, S0{.NEG}{.ABS}, (S3|_)

Phase1: -

Phase2: -

Description: Trigonometric range reduction, sine/cosine.

Used for making the result of sin/cos/etc. operations more precise.

If iteration = 0 and PARTA:

W0 = Range Reduce(S0)
W1 = Range Reduce(S0)(data for PARTB)

For all other cases:

W0 = Range Reduce(S0, S3) (result – PARTB only)
W1 = Range Reduce(S0, S3) (data for PARTB or next itr)

Where S0 is the original input value and S3 is the data from the previous iteration.

If P0 is set then P = Perform further iteration

This instruction happens in two parts, both parts are required (see example usage below)

W0 does not contain any useful data in part A and may be discarded.

W1 may be discarded on the last iteration.


void main()
	fragColor = sin(a);
0    : fred.sin i1, i0, _, 0, sh0, 

1    : fred.sin.partb i0, ft0, _, 0, sh0, i0

2    : fsinc r0, p0, i0