How to convert from ubyte[] to and from float?

Charles Hixson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 18 18:06:23 PDT 2014


What is the best way to convert from a part of a ubyte[] to a float?

I've tried converting the ubyte[] into a uint, but neither casting the 
uint to a float nor to!float work.

I suppose I could use a "trick record" union, but that seems inelegant.  
If I use pointers, the alignment may (unpredictably) not be proper 
(whatever that means these days).


More information about the Digitalmars-d-learn mailing list