From f529d3d2d2b89bbe0bbcad95c338baeb547eebc0 Mon Sep 17 00:00:00 2001 From: "U-SLAVA-FB3999113\\Slava" Date: Thu, 18 Oct 2007 02:38:35 -0400 Subject: [PATCH] Load fixes for core/math --- core/math/integers/integers-docs.factor | 4 ---- core/math/math.factor | 3 +++ extra/math/constants/constants-docs.factor | 8 -------- extra/math/functions/functions-docs.factor | 2 +- extra/math/ratios/ratios-docs.factor | 4 ++++ extra/math/ratios/ratios.factor | 2 +- 6 files changed, 9 insertions(+), 14 deletions(-) mode change 100644 => 100755 extra/math/constants/constants-docs.factor mode change 100644 => 100755 extra/math/ratios/ratios-docs.factor diff --git a/core/math/integers/integers-docs.factor b/core/math/integers/integers-docs.factor index e21e9c7102..b319e028fb 100755 --- a/core/math/integers/integers-docs.factor +++ b/core/math/integers/integers-docs.factor @@ -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 } } diff --git a/core/math/math.factor b/core/math/math.factor index 02e2b433c4..7f796e91b7 100755 --- a/core/math/math.factor +++ b/core/math/math.factor @@ -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? diff --git a/extra/math/constants/constants-docs.factor b/extra/math/constants/constants-docs.factor old mode 100644 new mode 100755 index 5945bb26c6..92c96985c3 --- a/extra/math/constants/constants-docs.factor +++ b/extra/math/constants/constants-docs.factor @@ -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" } } ; diff --git a/extra/math/functions/functions-docs.factor b/extra/math/functions/functions-docs.factor index 3803e71fae..08f3918197 100755 --- a/extra/math/functions/functions-docs.factor +++ b/extra/math/functions/functions-docs.factor @@ -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" diff --git a/extra/math/ratios/ratios-docs.factor b/extra/math/ratios/ratios-docs.factor old mode 100644 new mode 100755 index d661a68752..d996acaf1f --- a/extra/math/ratios/ratios-docs.factor +++ b/extra/math/ratios/ratios-docs.factor @@ -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." } ; diff --git a/extra/math/ratios/ratios.factor b/extra/math/ratios/ratios.factor index d92d33899a..954fd8dd20 100755 --- a/extra/math/ratios/ratios.factor +++ b/extra/math/ratios/ratios.factor @@ -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>