Skip to content

4 + 4 = 16 ? #422

@mad1ost

Description

@mad1ost
const gpu = new GPU();
var myFunc = gpu.createKernel(function(a, b) {
    return a[this.thread.x] + b[this.thread.x];
}).setOutput([10]);
console.log(myFunc([0,1,2,3,4,5,6,7,8,9], [0,1,2,3,4,5,6,7,8,9]));
Float32Array(10) [0, 1.9999998807907104, 4, 5.999999523162842, 15.999999046325684, 15.999999046325684, 15.999999046325684, 15.999999046325684, 15.999999046325684, 15.999999046325684]

If use this code with files from https://github.com/abhisheksoni27/gpu.js-demo (using setDimensions instead setOutput) or in http://gpu.rocks/playground the result will be

Float32Array(10) [0, 1.9999998807907104, 4, 5.999999523162842, 15.999999046325684, 10, 12, 14, 16, 17.999998092651367]

but also 4 + 4 = 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions