toFloating

Convert unsigned input to floating point.

Slice!(ReturnType*, 3)
toFloating
(
ReturnType = double
Iterator
)
(
Slice!(Iterator, 3) input
)

Examples

import std.math : approxEqual;

// dfmt off
ubyte[] rgb = [
    255, 0, 0,
    0, 255, 0,
    0, 0, 255,
    120, 120, 120
];

Slice!(double*, 3) rgbDouble = [
    1.0, 0.0, 0.0,
    0.0, 1.0, 0.0,
    0.0, 0.0, 1.0,
    0.470588, 0.470588, 0.470588
].sliced(4, 1, 3);
//dfmt on

assert(approxEqual(rgb.sliced(4, 1, 3).toFloating, rgbDouble));

Meta