Skip to content Skip to sidebar Skip to footer
Showing posts with the label Floating Point

Convert A Number Into A 16-bit Float (stored As Bytes) And Back?

For (lossy) compression purposes, I'd like to be able to convert Javascript numbers into 16-bit… Read more Convert A Number Into A 16-bit Float (stored As Bytes) And Back?

Tolocalestring, Percentages, And Firefox 38

I'm trying to format a percentage to have three significant figures. I'd like a fairly smal… Read more Tolocalestring, Percentages, And Firefox 38

Why Does Math.cbrt(1728) Produce A More Accurate Result Than Math.pow(1728, 1/3)?

In JavaScript, Math.cbrt(1728) evaluate to the exact result of 12. However, the seemingly-equivale… Read more Why Does Math.cbrt(1728) Produce A More Accurate Result Than Math.pow(1728, 1/3)?

How Small Can A Javascript Number Be Without Displaying In Scientific Notation?

I've made some code that rounds off a number to a given number of decimal places but will use m… Read more How Small Can A Javascript Number Be Without Displaying In Scientific Notation?

Javascript Float Comparison

I'm having a big problem with number comparison in javascript. The script accuses that the comp… Read more Javascript Float Comparison

How Can I Round A Float Such That There Are Only Two Trailing Digits After The Decimal Point?

I have a float number like 137.57667565656 but I would like to round it such that there are only tw… Read more How Can I Round A Float Such That There Are Only Two Trailing Digits After The Decimal Point?

Implementing An Accurate Cbrt() Function Without Extra Precision

In JavaScript, there is no native cbrt method available. In theory, you could use a method like thi… Read more Implementing An Accurate Cbrt() Function Without Extra Precision

Javascript Float Subtract

I was wondering how can I subtract two negative Floating-Point numbers in javascript. I tried: aler… Read more Javascript Float Subtract