Coder Social home page Coder Social logo

Comments (3)

zqianem avatar zqianem commented on July 27, 2024 2

I did a git bisect and it looks like the culprit is 92e5f2c.

Another case:

#!/bin/env -S deno run

import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
import { f16round } from "https://deno.land/x/[email protected]/mod.ts";

assertEquals(f16round(7.9999999), 8); // => 4

from float16.

petamoriken avatar petamoriken commented on July 27, 2024 2

I have found a way to fix this bug. It is expected to be fixed by tomorrow.

from float16.

bbbbx avatar bbbbx commented on July 27, 2024

Just a quick test, numbers starting with 0.4999 will be converted to 0.25 (0x3400)

const array = new Float16Array(1000);
for (let i = 0; i < 1000; i++) {
  const dValue = 0.4999 + i * 0.0000001;
  array[i] = dValue;
  console.log(dValue, 'to', array[i]);
  if (array[i] !== 0.25) debugger
}
console.log(array.buffer);

There are more accurate numbers:

  • 0x3800 => 0.5
  • 0x37ff => 0.499755859375

from float16.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.