rcpsafe
Returns the reciprocal of a float value, or zero if the magnitude of the value isn't greater than epsilon.
Read time 4 minutesLast updated 5 days ago
Definition
- Type: Method
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
rcpsafe(float, float)
Returns the reciprocal of a float value, or zero if the magnitude of the value isn't greater than epsilon.
public static float rcpsafe(float x, float epsilon = 1.1754944E-38)
Parameters
Returns
Type | Description |
|---|---|
| float | The reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Inputs with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(float2, float)
Returns the componentwise reciprocal of a float2 vector, or zero for each component whose magnitude isn't greater than epsilon.
public static float2 rcpsafe(float2 x, float epsilon = 1.1754944E-38)
Parameters
Returns
Type | Description |
|---|---|
| float2 | The componentwise reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Components with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(float3, float)
Returns the componentwise reciprocal of a float3 vector, or zero for each component whose magnitude isn't greater than epsilon.
public static float3 rcpsafe(float3 x, float epsilon = 1.1754944E-38)
Parameters
Returns
Type | Description |
|---|---|
| float3 | The componentwise reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Components with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(float4, float)
Returns the componentwise reciprocal of a float4 vector, or zero for each component whose magnitude isn't greater than epsilon.
public static float4 rcpsafe(float4 x, float epsilon = 1.1754944E-38)
Parameters
Returns
Type | Description |
|---|---|
| float4 | The componentwise reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Components with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(double, double)
Returns the reciprocal of a double value, or zero if the magnitude of the value isn't greater than epsilon.
public static double rcpsafe(double x, double epsilon = 2.2250738585072014E-308)
Parameters
Returns
Type | Description |
|---|---|
| double | The reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Inputs with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(double2, double)
Returns the componentwise reciprocal of a double2 vector, or zero for each component whose magnitude isn't greater than epsilon.
public static double2 rcpsafe(double2 x, double epsilon = 2.2250738585072014E-308)
Parameters
Returns
Type | Description |
|---|---|
| double2 | The componentwise reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Components with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(double3, double)
Returns the componentwise reciprocal of a double3 vector, or zero for each component whose magnitude isn't greater than epsilon.
public static double3 rcpsafe(double3 x, double epsilon = 2.2250738585072014E-308)
Parameters
Returns
Type | Description |
|---|---|
| double3 | The componentwise reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Components with a magnitude that isn't greater than epsilon, including NaN, return zero.
rcpsafe(double4, double)
Returns the componentwise reciprocal of a double4 vector, or zero for each component whose magnitude isn't greater than epsilon.
public static double4 rcpsafe(double4 x, double epsilon = 2.2250738585072014E-308)
Parameters
Returns
Type | Description |
|---|---|
| double4 | The componentwise reciprocal of the input, or zero. |
Remarks
Unlike math.rcp, this function never divides by zero. Components with a magnitude that isn't greater than epsilon, including NaN, return zero.