Document division by zero behavior

darcs
slava 2006-09-16 19:57:07 +00:00
parent ef865ffd96
commit 6bd500c34b
3 changed files with 19 additions and 14 deletions

View File

@ -15,6 +15,7 @@
- track individual method usages
- variable width word wrap
- add-gadget, model-changed, set-model should compile
- set-model set-model* and control-changed: its a hack, clean it up
- graphical module manager tool
- editor:
- more efficient multi-line inserts
@ -22,17 +23,16 @@
space
- we have trouble drawing rectangles
- ui browser: show currently selected vocab & words
- the editor should fill up the interior of the scroller completely
- doc sweep
- tool help
- perhaps commands window should sort by gesture
- merge keyboard help with help in some way
- keyboard help: hide commands whose gestures are shadowed
- division by zero may not raise an error -- document this
- the editor should fill up the interior of the scroller completely
+ ui:
- help tool: edit, reload buttons
- words:
- S+left: reload
- S+right: inspect
@ -46,7 +46,6 @@
- page scrolling should be timer-based too
- invoking interactor commands when interactor is busy -- still fucked
because of grafting and ungrafting
- set-model set-model* and control-changed: its a hack, clean it up
- x11: scroll up/down wiggles caret
- roundoff is still not quite right with tracks
- fix top level window positioning
@ -78,7 +77,8 @@
- horizontal wheel scrolling
- polish OS X menu bar code
- structure editor
- mouse over for input:
- mouse over for input w/ multiple lines looks stupid
+ module system:
- convention for main entry point of a module

View File

@ -17,6 +17,13 @@ ARTICLE: "number-types" "Types of numbers"
{ $subsection "floats" }
{ $subsection "complex-numbers" } ;
ARTICLE: "division-by-zero" "Division by zero"
"Floating point division never raises an error if the denominator is zero. This means that if at least one of the two inputs to " { $link / } ", " { $link /f } " or " { $link mod } " is a float, the result will be a floating point infinity or not a number value."
$terpri
"The behavior of integer division is hardware specific. On x86 processors, " { $link /i } " and " { $link mod } " raise an error if both inputs are integers and the denominator is zero. On PowerPC, integer division by zero yields a result of zero."
$terpri
"On the other hand, the " { $link / } " word, when given integer arguments, implements a much more expensive division algorithm which always yields an exact rational answer, and this word always tests for division by zero explicitly." ;
ARTICLE: "number-protocol" "Number protocol"
"Math operations obey certain numerical upgrade rules. If one of the inputs is a bignum and the other is a fixnum, the latter is first coerced to a bignum; if one of the inputs is a float, the other is coerced to a float."
$terpri
@ -29,7 +36,7 @@ $terpri
{ $subsection * }
{ $subsection / }
"Non-commutative operations take operands from the stack in the natural order; " { $snippet "6 2 /" } " divides 6 by 2."
$terpri
{ $subsection "division-by-zero" }
"Real numbers (but not complex numbers) can be ordered:"
{ $subsection < }
{ $subsection <= }

View File

@ -68,7 +68,7 @@ HELP: /
"Division of ratios and complex numbers proceeds using the relevant mathematical rules."
}
}
{ $errors "Throws an error if both inputs are integers, and the denominator is 0." } ;
{ $see-also "division-by-zero" } ;
HELP: /i
{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } }
@ -81,7 +81,7 @@ HELP: /i
"Integer division of ratios and complex numbers proceeds using the relevant mathematical rules."
}
}
{ $errors "Throws an error if both inputs are integers, and the denominator is 0." } ;
{ $see-also "division-by-zero" } ;
HELP: /f
{ $values { "x" "a real number" } { "y" "a real number" } { "z" "a real number" } }
@ -94,7 +94,7 @@ HELP: /f
"Integer division of ratios and complex numbers proceeds using the relevant mathematical rules."
}
}
{ $errors "Throws an error if both inputs are integers, and the denominator is 0." } ;
{ $see-also "division-by-zero" } ;
HELP: mod
{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
@ -105,8 +105,7 @@ HELP: mod
"Modulus of bignums always yields a bignum."
}
}
{ $errors "Throws an error if the denominator is 0." }
{ $see-also rem } ;
{ $see-also "division-by-zero" rem } ;
HELP: /mod
{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } { "w" "an integer" } }
@ -117,7 +116,7 @@ HELP: /mod
"The quotient and remainder of two bignums is always a bignum."
}
}
{ $errors "Throws an error if the denominator is 0." } ;
{ $see-also "division-by-zero" } ;
HELP: bitand
{ $values { "x" "an integer" } { "y" "an integer" } { "z" "an integer" } }
@ -225,8 +224,7 @@ HELP: rem
"Modulus of bignums always yields a bignum."
}
}
{ $errors "Throws an error if the denominator is 0." }
{ $see-also mod } ;
{ $see-also "division-by-zero" mod } ;
HELP: sgn
{ $values { "x" "a real number" } { "n" "-1, 0 or 1" } }