News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Convert REAL4 to HALF

Started by aw27, September 13, 2018, 01:01:37 AM

Previous topic - Next topic

aw27

As a follow up of this, I present here 2 methods of converting 1 REAL4 to 1 HALF, the VCVTPS2PH method and the no-VCVTPS2PH method.
The first one is the best but may not work on all computers.
I compare if the result obtained from both methods yields the same result. It does  :biggrin: (in this case)


HALF values are equal


BTW, I have not figured out yet know how to print a HALF (without converting it back of course). Anyone?

Siekmanski

Creative coders use backward thinking techniques as a strategy.

jj2007

On my Core i5-2450M, vcvtps2ph xmm1, xmm0 is an illegal instruction.

aw27

Quote from: jj2007 on September 13, 2018, 01:55:37 AM
On my Core i5-2450M, vcvtps2ph xmm1, xmm0 is an illegal instruction.

You need an Ivy Bridge or later.

FORTRANS

Hi,

   Intel Core i3 4005U.

HALF values are equal

Steve N.

hutch--

Haswell E/EP

HALF values are equal

daydreamer

Quote from: AW on September 13, 2018, 01:01:37 AM
As a follow up of this, I present here 2 methods of converting 1 REAL4 to 1 HALF, the VCVTPS2PH method and the no-VCVTPS2PH method.
The first one is the best but may not work on all computers.
I compare if the result obtained from both methods yields the same result. It does  :biggrin: (in this case)

BTW, I have not figured out yet know how to print a HALF (without converting it back of course). Anyone?
doesnt work
I Think its more interesting to be able to store twice the amount meshes in a demo
isnt it actually what you get from importing 3d files,double values in ascii->half's much smaller?

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

Now, I will not use the modern instructions, some people still has pre- Ivy Bridge computers, and will print the HALF by converting it back and consider 4 significant digits (it has 3/4 significant digits), by luck in this case the 4th digit is still valid.


REAL4 Value=1.234567
HALF Value=1.234


@daydream
All depends on what you have in mind

Siekmanski

Nice  :biggrin:

Daydreamer, to compress vertex data, use "vertex subdivision" and convert the data to half floats  ( the files will be incredible small ).
Creative coders use backward thinking techniques as a strategy.

daydreamer

Quote from: AW on September 15, 2018, 12:37:49 AM
Now, I will not use the modern instructions, some people still has pre- Ivy Bridge computers, and will print the HALF by converting it back and consider 4 significant digits (it has 3/4 significant digits), by luck in this case the 4th digit is still valid.


REAL4 Value=1.234567
HALF Value=1.234


@daydream
All depends on what you have in mind
Would be nice to add aircraft meshes and other meshes as small  together in my project with procedural terrain making
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding