Merge branch 'master' of git://factorcode.org/git/factor
commit
de458348c0
|
@ -240,3 +240,12 @@ unit-test
|
|||
|
||||
[ 17 ] [ 17 >bignum 5 max ] unit-test
|
||||
[ 5 ] [ 17 >bignum 5 min ] unit-test
|
||||
|
||||
[ 1 ] [ 1 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784 /f double>bits ] unit-test
|
||||
[ 12 ] [ 3 50600563326827654588123836679729326762389162441035529589225339506857584891998836722990095925359281123796769466079202977847452184346448369216753349985184627480379356069141590341116726935523304085309941919618186267140501870856173174654525838912289889085202514128089692388083353653807625633046581877161501565826926935273373696 /f double>bits ] unit-test
|
||||
[ 123 ] [ 123 202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784 /f double>bits ] unit-test
|
||||
[ 1234 ] [ 617 101201126653655309176247673359458653524778324882071059178450679013715169783997673445980191850718562247593538932158405955694904368692896738433506699970369254960758712138283180682233453871046608170619883839236372534281003741712346349309051677824579778170405028256179384776166707307615251266093163754323003131653853870546747392 /f double>bits ] unit-test
|
||||
[ 1/0. ] [ 2048 2^ 1 /f ] unit-test
|
||||
[ -1/0. ] [ 2048 2^ -1 /f ] unit-test
|
||||
[ -1/0. ] [ 2048 2^ neg 1 /f ] unit-test
|
||||
[ 1/0. ] [ 2048 2^ neg -1 /f ] unit-test
|
||||
|
|
|
@ -121,12 +121,16 @@ M: bignum (log2) bignum-log2 ; inline
|
|||
[ /mod ] dip ; inline
|
||||
|
||||
! Third step: post-scaling
|
||||
: scaled-float ( mantissa scale -- n )
|
||||
[ 52 2^ 1 - bitand ] dip 1022 + 52 shift bitor bits>double ; inline
|
||||
: scale-float ( mantissa scale -- float' )
|
||||
{
|
||||
{ [ dup 1024 > ] [ 2drop 1/0. ] }
|
||||
{ [ dup -1023 < ] [ 1021 + shift bits>double ] }
|
||||
[ [ 52 2^ 1 - bitand ] dip 1022 + 52 shift bitor bits>double ]
|
||||
} cond ; inline
|
||||
|
||||
: post-scale ( mantissa scale -- n )
|
||||
[ 2/ ] dip over log2 52 > [ [ 2/ ] [ 1 + ] bi* ] when
|
||||
scaled-float ; inline
|
||||
scale-float ; inline
|
||||
|
||||
: round-to-nearest ( fraction-and-guard rem -- fraction-and-guard' )
|
||||
over odd?
|
||||
|
|
|
@ -533,13 +533,14 @@ HELP: QUALIFIED:
|
|||
{ $examples { $example
|
||||
"USING: prettyprint ;"
|
||||
"QUALIFIED: math"
|
||||
"1 2 math:+ ." "3"
|
||||
"1 2 math:+ ."
|
||||
"3"
|
||||
} } ;
|
||||
|
||||
HELP: QUALIFIED-WITH:
|
||||
{ $syntax "QUALIFIED-WITH: vocab word-prefix" }
|
||||
{ $description "Like " { $link POSTPONE: QUALIFIED: } " but uses " { $snippet "word-prefix" } " as prefix." }
|
||||
{ $examples { $code
|
||||
{ $examples { $example
|
||||
"USING: prettyprint ;"
|
||||
"QUALIFIED-WITH: math m"
|
||||
"1 2 m:+ ."
|
||||
|
|
Loading…
Reference in New Issue