factor/library/math/constants.factor

26 lines
782 B
Factor
Raw Normal View History

! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: kernel-internals
2006-05-05 21:41:57 -04:00
USING: kernel namespaces math ;
: bootstrap-cell \ cell get ; inline
: cells cell * ; inline
: bootstrap-cells bootstrap-cell * ; inline
: cell-bits 8 cells ; inline
2006-03-19 20:28:07 -05:00
: bootstrap-cell-bits 8 bootstrap-cells ; inline
2006-05-05 21:41:57 -04:00
: tag-address ( x tag -- tagged ) swap tag-bits shift bitor ;
: tag-header ( id -- tagged ) object-tag tag-address ;
2004-09-07 23:47:18 -04:00
IN: math
: i C{ 0 1 } ; inline
: -i C{ 0 -1 } ; inline
2004-09-07 23:47:18 -04:00
: e 2.7182818284590452354 ; inline
: pi 3.14159265358979323846 ; inline
2005-12-10 01:02:13 -05:00
: epsilon 2.2204460492503131e-16 ; inline
2006-05-14 20:05:57 -04:00
: first-bignum 1 bootstrap-cell-bits tag-bits - 1- shift ;
: most-positive-fixnum first-bignum 1- >fixnum ;
: most-negative-fixnum first-bignum neg >fixnum ;