Merge branch 'dcn' of git://factorcode.org/git/factor into dcn

db4
Slava Pestov 2009-07-27 16:57:13 -05:00
commit 88424a9593
4 changed files with 10 additions and 10 deletions

View File

@ -9,21 +9,21 @@ HELP: >float
{ $description "Converts a real to a float. This is the identity on floats, and performs a floating point division on rationals." } ; { $description "Converts a real to a float. This is the identity on floats, and performs a floating point division on rationals." } ;
HELP: bits>double ( n -- x ) HELP: bits>double ( n -- x )
{ $values { "n" "a 64-bit integer representing an 754 double-precision float" } { "x" float } } { $values { "n" "a 64-bit integer representing an IEEE 754 double-precision float" } { "x" float } }
{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ; { $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
{ bits>double bits>float double>bits float>bits } related-words { bits>double bits>float double>bits float>bits } related-words
HELP: bits>float ( n -- x ) HELP: bits>float ( n -- x )
{ $values { "n" "a 32-bit integer representing an 754 single-precision float" } { "x" float } } { $values { "n" "a 32-bit integer representing an IEEE 754 single-precision float" } { "x" float } }
{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ; { $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
HELP: double>bits ( x -- n ) HELP: double>bits ( x -- n )
{ $values { "x" float } { "n" "a 64-bit integer representing an 754 double-precision float" } } { $values { "x" float } { "n" "a 64-bit integer representing an IEEE 754 double-precision float" } }
{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ; { $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
HELP: float>bits ( x -- n ) HELP: float>bits ( x -- n )
{ $values { "x" float } { "n" "a 32-bit integer representing an 754 single-precision float" } } { $values { "x" float } { "n" "a 32-bit integer representing an IEEE 754 single-precision float" } }
{ $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ; { $description "Creates a " { $link float } " object from a binary representation. This word is usually used to reconstruct floats read from streams." } ;
! Unsafe primitives ! Unsafe primitives
@ -74,7 +74,7 @@ HELP: float>= ( x y -- ? )
ARTICLE: "floats" "Floats" ARTICLE: "floats" "Floats"
{ $subsection float } { $subsection float }
"Rational numbers represent " { $emphasis "exact" } " quantities. On the other hand, a floating point number is an " { $emphasis "approximation" } ". While rationals can grow to any required precision, floating point numbers are fixed-width, and manipulating them is usually faster than manipulating ratios or bignums (but slower than manipulating fixnums). Floating point numbers are often used to represent irrational numbers, which have no exact representation as a ratio of two integers." "Rational numbers represent " { $emphasis "exact" } " quantities. On the other hand, a floating point number is an " { $emphasis "approximate" } " value. While rationals can grow to any required precision, floating point numbers have limited precision, and manipulating them is usually faster than manipulating ratios or bignums."
$nl $nl
"Introducing a floating point number in a computation forces the result to be expressed in floating point." "Introducing a floating point number in a computation forces the result to be expressed in floating point."
{ $example "5/4 1/2 + ." "1+3/4" } { $example "5/4 1/2 + ." "1+3/4" }

View File

@ -289,11 +289,11 @@ HELP: <fp-nan>
HELP: next-float HELP: next-float
{ $values { "m" float } { "n" float } } { $values { "m" float } { "n" float } }
{ $description "Returns the least representable " { $link float } " value greater than " { $snippet "m" } "." } ; { $description "Returns the least representable " { $link float } " value greater than " { $snippet "m" } ", or in the case of " { $snippet "-0.0" } ", returns " { $snippet "+0.0" } "." } ;
HELP: prev-float HELP: prev-float
{ $values { "m" float } { "n" float } } { $values { "m" float } { "n" float } }
{ $description "Returns the greatest representable " { $link float } " value less than " { $snippet "m" } "." } ; { $description "Returns the greatest representable " { $link float } " value less than " { $snippet "m" } ", or in the case of " { $snippet "+0.0" } ", returns " { $snippet "-0.0" } "." } ;
{ next-float prev-float } related-words { next-float prev-float } related-words

View File

@ -40,7 +40,7 @@ COMPILE-AS-C++
C-INCLUDE: <cstring> C-INCLUDE: <cstring>
RAW-C: <RAW-C
class alpha { class alpha {
public: public:
alpha(const char* s) { alpha(const char* s) {
@ -68,7 +68,7 @@ class beta : alpha {
return str + 2; return str + 2;
}; };
}; };
; RAW-C>
C++-CLASS: alpha c++-root C++-CLASS: alpha c++-root
C++-CLASS: beta alpha C++-CLASS: beta alpha

View File

@ -604,7 +604,7 @@ ARTICLE: "alien.marshall" "C marshalling"
"Wrap an alien:" { $subsection alien-wrapper } "Wrap an alien:" { $subsection alien-wrapper }
"Wrap a struct:" { $subsection struct-wrapper } "Wrap a struct:" { $subsection struct-wrapper }
"Get the marshaller for a C type:" { $subsection marshaller } "Get the marshaller for a C type:" { $subsection marshaller }
"Get the unmarshaller for a C type:" { $subsection marshaller } "Get the unmarshaller for a C type:" { $subsection unmarshaller }
"Get the unmarshaller for an output parameter:" { $subsection out-arg-unmarshaller } "Get the unmarshaller for an output parameter:" { $subsection out-arg-unmarshaller }
"Get the unmarshaller for a struct field:" { $subsection struct-field-unmarshaller } "Get the unmarshaller for a struct field:" { $subsection struct-field-unmarshaller }
$nl $nl