BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):br_ufraction
Next|Prev|Up
The Integral Type
Arithmetic
Comparison
Conversion
Copy/Assign

# ` br_ufraction`

## The Integral Type

The `br_ufraction`
346 type can be used to represent numbers in the range [0,+1)*1. Although used internally, this type is not generally supported by the BRender API. One of the few places in which it is used is in specifying lighting coefficients of materials.

Under the floating point library, `br_ufraction`346 is a `float`. Under the fixed point library, `br_ufraction`346 is a 16 bit unsigned fixed point number.

### The `typedef`

(See `scalar.h `for precise declaration)

`float br_ufraction Floating point Unsigned Fraction`

`br_fixed_luf br_ufraction Fixed - Long Unsigned Fraction (0.16)`

## Arithmetic

No standard operators are supported. No macros are provided. Convert to `br_scalar`332 and use that type's arithmetic macros instead.

## Comparison

Equality and comparison with zero are valid. Other standard comparison operators may be implemented by macros in future versions, but are currently valid.

## Conversion

### From Numeric Constants

```BR_UFRACTION(x)
```
Convert `x `from any numeric constant to `br_ufraction`
346.

```BR_SCALAR_EPSILON
```
Smallest positive fractional value.

### From Integral Types

To convert from integral types, use `br_scalar`332 as an intermediary.

### From `br_scalar`332

```br_ufraction BrScalarToUFraction(br_scalar s)
```
Converts `s `from `br_scalar`332 to `br_ufraction`346. It is up to the application to ensure the value is in the required range.

### To Integral Types

To convert to integral types, use `br_scalar`332 as an intermediary.

### To `br_scalar`332

```br_scalar BrUFractionToScalar(br_ufraction f)
```
Converts `s `from `br_ufraction`346 to `br_scalar`332. It is up to the application to ensure the value is in the required range.

## Copy/Assign

Only assign zero, or fractions. Use conversions in all other cases.

Generated with
CERN WebMaker