Load fixes for core/math

release
U-SLAVA-FB3999113\Slava 2007-10-18 02:38:35 -04:00
parent b841dcc159
commit f529d3d2d2
6 changed files with 9 additions and 14 deletions

View File

@ -44,10 +44,6 @@ HELP: odd?
{ $values { "n" integer } { "?" "a boolean" } }
{ $description "Tests if an integer is odd." } ;
HELP: fraction>
{ $values { "a" integer } { "b" "a positive integer" } { "a/b" rational } }
{ $description "Creates a new ratio, or outputs the numerator if the denominator is 1. This word does not reduce the fraction to lowest terms, and should not be called directly; use " { $link / } " instead." } ;
! Unsafe primitives
HELP: fixnum+ ( x y -- z )
{ $values { "x" fixnum } { "y" fixnum } { "z" integer } }

View File

@ -90,6 +90,9 @@ M: real hashcode* nip >fixnum ;
M: real <=> - ;
! real and sequence overlap. we disambiguate:
M: integer <=> - ;
GENERIC: fp-nan? ( x -- ? )
M: object fp-nan?

8
extra/math/constants/constants-docs.factor Normal file → Executable file
View File

@ -3,8 +3,6 @@ IN: math.constants
ARTICLE: "math-constants" "Constants"
"Standard mathematical constants:"
{ $subsection i }
{ $subsection -i }
{ $subsection e }
{ $subsection pi }
"Various limits:"
@ -14,12 +12,6 @@ ARTICLE: "math-constants" "Constants"
ABOUT: "math-constants"
HELP: i
{ $values { "i" "the imaginary unit" } } ;
HELP: -i
{ $values { "-i" "the negated imaginary unit" } } ;
HELP: e
{ $values { "e" "base of natural logarithm" } } ;

View File

@ -1,5 +1,5 @@
USING: help.markup help.syntax kernel math
sequences quotations ;
sequences quotations math.functions.private ;
IN: math.functions
ARTICLE: "integer-functions" "Integer functions"

4
extra/math/ratios/ratios-docs.factor Normal file → Executable file
View File

@ -34,6 +34,10 @@ HELP: denominator ( a/b -- b )
{ $values { "a/b" rational } { "b" "a positive integer" } }
{ $description "Outputs the denominator of a rational number. Always outputs 1 with integers." } ;
HELP: fraction>
{ $values { "a" integer } { "b" "a positive integer" } { "a/b" rational } }
{ $description "Creates a new ratio, or outputs the numerator if the denominator is 1. This word does not reduce the fraction to lowest terms, and should not be called directly; use " { $link / } " instead." } ;
HELP: >fraction
{ $values { "a/b" rational } { "a" integer } { "b" "a positive integer" } }
{ $description "Extracts the numerator and denominator of a rational number." } ;

View File

@ -24,7 +24,7 @@ PRIVATE>
M: integer /
dup zero? [
/i
"Division by zero" throw
] [
dup 0 < [ [ neg ] 2apply ] when
2dup gcd nip tuck /i >r /i r> fraction>