arithmetic   809
GitHub - Spl1ce/Rational-Number-Class: This is a class that I made that is a plug and play version of a rational number library
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.
fraction  rational  number  maths  arithmetic  comparison  library  c  opensource  floss
march 2018 by gilberto5757
What Every Computer Scientist Should Know About Floating-Point Arithmetic
This appendix is an edited reprint of the paper What Every Computer Scientist Should Know About Floating-Point Arithmetic, by David Goldberg, published in the March, 1991 issue of Computing Surveys. Copyright 1991, Association for Computing Machinery, Inc., reprinted by permission.
arithmetic  math  paper  programming
january 2018 by jchris
Continued Fractions
I like con­tin­ued frac­tions for their elegance, their finite closure under a wider set of oper­a­tions than dec­imal expan­sion, and their most-sig­nif­icant-part-first arithmetic. But they run for unpre­dictable and pos­si­bly non-ter­minat­ing time before pro­vid­ing any informa­tion at all.
I pro­pose that a useful real-number rep­re­senta­tion would be equiv­a­lent to inter­vals that could be narrowed by applying a compu­ta­tion. Con­tin­ued frac­tions are such a narrow­ing inter­val: truncat­ing at an odd number of val­ues gives a lower bound, while truncat­ing at an even number gives an upper bound. The prob­lem is that not every answer gives such a narrow­ing inter­val because not all con­tin­ued frac­tions con­tin­ue. [1; 2, 2, …] is a narrow­ing inter­val, but [2], it’s square, must appear in an all-or-noth­ing way.
All of which begs the ques­tion, what rep­re­senta­tion should be used? It clearly will not be canon­ical, since we want to be able to rep­re­sent two as both an finite inte­ger and an infi­nitely-narrow­ing inter­val converg­ing on two. Beyond that, it isn’t clear. Some­thing to think about.
continued-fractions  algorithms  arithmetic  to-write-about  nudge-targets  consider:looking-to-see
december 2017 by Vaguery
Arithmetic with Continued Fractions
Multiprecision arithmetic algorithms usually represent real numbers as decimals, or perhaps as their base-2n analogues. But this representation has some puzzling properties. For example, there is no exact representation of even as simple a number as one-third. Continued fractions are a practical but little-known alternative.

Continued fractions are a representation of the real numbers that are in many ways more mathematically natural than the usual decimal or binary representations. All rational numbers have simple representations, and so do many irrational numbers, such as sqrt(2) and e1. One reason that continued fractions are not often used, however, is that it's not clear how to involve them in basic operations like addition and multiplication. This was an unsolved problem until 1972, when Bill Gosper found practical algorithms for continued fraction arithmetic.

In this talk, I explain what continued fractions are and why they are interesting, how to represent them in computer programs, and how to calculate with them.