fmod

> # NAME

> fmod - returns the remainder of x/y with the same sign as x

> # SYNOPSIS

>       float  fmod(float x, float y);
>       float1 fmod(float1 x, float1 y);
>       float2 fmod(float2 x, float2 y);
>       float3 fmod(float3 x, float3 y);
>       float4 fmod(float4 x, float4 y);

>       half   fmod(half x, half y);
>       half1  fmod(half1 x, half1 y);
>       half2  fmod(half2 x, half2 y);
>       half3  fmod(half3 x, half3 y);
>       half4  fmod(half4 x, half4 y);

>       fixed  fmod(fixed x, fixed y);
>       fixed1 fmod(fixed1 x, fixed1 y);
>       fixed2 fmod(fixed2 x, fixed2 y);
>       fixed3 fmod(fixed3 x, fixed3 y);
>       fixed4 fmod(fixed4 x, fixed4 y);

> # PARAMETERS

> x

>   Vector or scalar numerator

> y

>   Vector or scalar denominator

> # DESCRIPTION

> fmod returns the remainder of x divided by y with the same sign as x. If y is zero, the result is implementation-defined because of division by zero.

> For vectors, the returned vector contains the signed remainder of each element of the input vector.

> # REFERENCE IMPLEMENTATION

> fmod for an float2 vector could be implemented as:

>       float2 fmod(float2 a, float2 b)
>       {
>         float2 c = frac(abs(a/b))*abs(b);
>         return (a < 0) ? -c : c;   /* if ( a < 0 ) c = 0-c */
>       }

> # PROFILE SUPPORT

> fmod is supported in all profiles but fp20.

> # SEE ALSO

> abs, frac