Skip to content

Issue in converting float16 to float32 #1163

@abhinav2712

Description

@abhinav2712

I am trying to convert float16 to float32 using inbuilt functions however getting same output:

const array = new Float16Array([1.0, 1.1, 1.2, 1.3]);
  for (const value of array) {
    // 1, 1.099609375, 1.2001953125, 1.2998046875
    console.log(value);
  }
  const float32Array = new Float32Array(array.length);

  // Iterate over the Float16Array and convert each element to Float32
  for (let i = 0; i < array.length; i++) {
    float32Array[i] = array[i];
  }

  // Now float32Array contains the converted values
  console.log("f32:", float32Array);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions