![chicken math definition chicken math definition](https://i.pinimg.com/originals/91/d7/48/91d748e7886386ea5aff8e724825421a.jpg)
An even better one is error in ulps see fpulp and fpulp-error. (Compare the same examples with absolute-error.) Because flonums are particularly dense near zero, this makes relative error better than absolute error for measuring the error in a flonum approximation. In the last two examples, relative error is high because the result is near zero.
![chicken math definition chicken math definition](http://1.bp.blogspot.com/-u7OXXQfIaRQ/VqfnHlZIFEI/AAAAAAABDFw/iUBIN3Rp2Zw/s1600/Bantam%2Band%2Blarge%2Bfowl.jpg)
This function usually computes (abs (/ (- x r) r)) using exact rationals, but handles non-rational reals such as +inf.0 specially, as well as r = 0. Measures how close an approximation x is to the correct value r, relative to the magnitude of r. Usually computes (abs (- x r)) using exact rationals, but handles non-rational reals such as +inf.0 specially. Returns a random integer n such that ( number Returns a random natural number less than k, which must be positive. Random Number Generation (random-natural k) -> integer (In fact, the inexact numbers in xs are summed separately using fpsum). Like (apply + xs), but incurs rounding error only once when adding inexact numbers. Returns #t when x is an integer power of 2. Returns a new complex number with a flonum real part and a flonum imaginary part. Returns #t when v is an inexact complex number. > euler.0Īn approximation of G, or Catalan's constant. > phi.0Īn approximation of e, or Euler's number. Constants phi.0Īn approximation of φ, the golden ratio. Note: This is currently missing procedures from racket/math that the original racket library re-exports. This may also lead to undefined behavior in some cases. This implementation just uses CHICKEN's chicken.fixnum module, which is unsafe. In some places the original implementation references unsafe- fx and fl operators, but these are actually just aliased to safe operators.It's possible some undefined behavior may occur with arguments of the wrong type, since a good amount of the original functions were originally defined in typed racket, which AFAIK would catch those and throw an exception.
![chicken math definition chicken math definition](https://i.pinimg.com/236x/94/55/79/94557959b5307d8f8252b05a7c680fff--my-friend-friends.jpg)
There may be missing modules and features. This egg is still largely under active development. The following documentation is largely a direct copy of the racket documentation, re-formatted for svnwiki and tweaked for the CHICKEN implementation. Math is a CHICKEN port of racket's math library.