Published
Edited
Jul 27, 2019
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
// try adding 0, 1 or 2 to the denominator of bigfrac
// and notice that evaluate() goes from 1 to 1 to 0 due to BigInt rounding
// TODO: fix it so it rounds better (at least it should be monotonic)
bigfrac.evaluate();
Insert cell
Insert cell
negTwentyFourSevenths.evaluate();
Insert cell
threeAndABit.evaluate();
Insert cell
negThreeAndABit.evaluate();
Insert cell
negTwentyFourSevenths = new BigRational(-24/7);
Insert cell
negThreeAndABit = new BigRational(-3.4567);
Insert cell
threeAndABit = negThreeAndABit.negate();
Insert cell
oneThird = three.reciprocal();
Insert cell
twoFifths = two.dividedBy(5);
Insert cell
threeFifths = three.dividedBy(five);
Insert cell
testAddition = oneThird.plus(threeFifths);
Insert cell
testSubtraction = oneThird.minus(twoFifths);
Insert cell
testMultiplication = oneThird.times(twoFifths);
Insert cell
testDivision = oneThird.dividedBy(twoFifths);
Insert cell
two = new BigRational(2n);
Insert cell
three = two.plus(one);
Insert cell
four = two.plus(two);
Insert cell
five = new BigRational(5);
Insert cell
six = two.times(three);
Insert cell
neg1 = new BigRational(-1);
Insert cell
neg2 = one.minus(three);
Insert cell
neg3 = three.negate();
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