Public
Edited
Apr 11, 2024
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable value1 = 1
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
2/3
Insert cell
new Fraction(parseFloat(2/3))
Insert cell
((0.2 / 0.3) * 10.0) / 10.0
Insert cell
0.2 + 0.1;
Insert cell
(0.2 + 0.1).toFixed(3)
Insert cell
((0.2 / 100) * (0.3 / 100)) * 100
Insert cell
function highestCommonFactor(a,b) {
if (b==0) return a;
return highestCommonFactor(b,a%b);
}
Insert cell
function fractionDecimal(decimal){
var decimal = decimal.toString()
var decimalArray = decimal.split(".");
var leftDecimalPart = decimalArray[0]; // 1
var rightDecimalPart = decimalArray[1]; // 75

var numerator = leftDecimalPart + rightDecimalPart // 175
var denominator = Math.pow(10,rightDecimalPart.length); // 100
var factor = highestCommonFactor(numerator, denominator); // 25
denominator /= factor;
numerator /= factor;
return [decimal, numerator, denominator]
}
Insert cell
fractionDecimal(2/3)
Insert cell
fractionDecimal('0.666666666666666666666666')
Insert cell
('0.666666666666666666666666').split('.')[1].length
Insert cell
+(2/3).toFixed(24)
Insert cell
fractionDecimal(2/3)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3@6")
Insert cell
Fraction = require('fractional@1.0.0/index.js').catch(() => window["Fraction"])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more