Platforms to show: All Mac Windows Linux Cross-Platform

Back to MemoryBlock class.

MemoryBlock.Float64ToFloat32MBS(Source as Ptr, Count as Integer, SourceOffset as Integer = 0, DestinationOffset as Integer = 0)   New in 26.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MemoryBlock MBS Util Plugin 26.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts a block of 64-bit floating point numbers to 32-bit.
Example
// we fill a memoryblock and convert 64 -> 32 -> 16 -> 32 -> 64 to try all combinations

Var m1 As New MemoryBlock(100 * 8)
Var m2 As New MemoryBlock(100 * 4)
Var m3 As New MemoryBlock(100 * 2)
Var m4 As New MemoryBlock(100 * 4)
Var m5 As New MemoryBlock(100 * 8)

var o as integer
For i As Integer = 1 To 100
m1.DoubleValue(o) = i / 10.0
o = o + 8
Next

m2.Float64ToFloat32MBS(m1, 100)
m3.Float32ToFloat16MBS(m2, 100)
m4.Float16ToFloat32MBS(m3, 100)
m5.Float32ToFloat64MBS(m4, 100)

MessageBox m5.DoubleValue(8 * 49).ToString // should be 5

We read Count * 8 bytes from source and write 4 * Count bytes to destination.

Blog Entries

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...