Comments (9)
I forgot to write that the endian value must be set to true, also, after tracing, the error seems to happen when "the alignment is not good" and the value is read using "value = this['_get' + type](this._start + byteOffset, littleEndian);". After testing with a change of bit order, I conclude that the problem happens in the _getFloat32 function whatever endianness is used.
from jdataview.
To correct the bug, change these 3 variables' assignment in the _getFloat32 method :
sign = 1 - (2 * ((b0 >> 7) & 0x01)),
exponent = (((b0 << 1) & 0x00fe) | ((b1 >> 7) & 0x01)) - 127,
mantissa = ((b1 << 16) & 0x7F0000) | ((b2 << 8) & 0xFF00) | b3;
from jdataview.
I am in an exam week, will check this out tomorrow. Thanks for locating the issue, it'll help to fix it.
from jdataview.
The changes you made seem weird.
I borrowed the conversion code from Three.js, I believe there are no errors there ...
https://github.com/mrdoob/three.js/blob/master/src/extras/io/BinaryLoader.js
from jdataview.
https://github.com/vjeux/jsDataView/commit/66a523fcd285e9e5d8db51dc724b7f029b0df255
I made a commit to fix some issues. This is partially fixing your bug.
from jdataview.
http://en.wikipedia.org/wiki/IEEE_754-1985
Ok! This is not the same value because of denormalized numbers. Have to go to sleep, will fix it tomorrow :)
from jdataview.
I didn't test extensively the changes I made but at least, the simple mesh I tried to load using the modified script loaded right. It's a bit sad though that this code end up being used sometimes by chrome inside a web worker since the dataview isn't available in that context. Good luck with your exams!
Ps : Oups, I hit the close option and don't know how to cancel it...
from jdataview.
I have made some updates, can you retest please?
Note: I changed littleEndian to be set to TRUE by default. Because x86 architecture is littleEndian, all the files we have to deal with are in littleEndian. I have added a last argument to the jDataView constructor to set the default behavior of littleEndian.
new jDataView(buffer, undefined, undefined, false)
to get the original behavior.
from jdataview.
Seems to be working great! I'll close the issue.
Thank you.
from jdataview.
Related Issues (20)
- Uint64.toString fails for large numbers HOT 2
- Using jDataView in chrome throws Uncaught ReferenceError: NODE is not defined HOT 3
- Better support for negative bitLength HOT 11
- Use backing buffer/view's methods when available. HOT 5
- Use native methods for bit access HOT 4
- Remove string concatenation at runtime HOT 3
- Bitfields doesn't work well in littleEndian mode HOT 1
- Dist file without sourceMappingURL HOT 5
- it
- Bitfield API ignores endianness. HOT 2
- Question: Is jDataView runnable in web worker? HOT 1
- Question: How to convert the "uint16" value to half-precision float (i.e. "float16")? HOT 1
- Weird Float types (48 & 80 bit) HOT 1
- readString() with variable 7-bit based integer as prefix length HOT 1
- untar demo intersperses chunks of JavaScript in textareas HOT 1
- dataview constructor argument offset is invalid HOT 10
- Getting an error only after minification of dist/browser/jdataview.js? HOT 4
- Constuctor doesn't work the same as a real DataView? HOT 7
- Cannot use 'in' operator to search for 'Buffer' in undefined HOT 5
- Remove old fallbacks HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jdataview.