aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/clip.spad.pamphlet20
-rw-r--r--src/algebra/plot.spad.pamphlet7
-rw-r--r--src/algebra/sf.spad.pamphlet6
3 files changed, 18 insertions, 15 deletions
diff --git a/src/algebra/clip.spad.pamphlet b/src/algebra/clip.spad.pamphlet
index 6be59d84..6804f0ab 100644
--- a/src/algebra/clip.spad.pamphlet
+++ b/src/algebra/clip.spad.pamphlet
@@ -91,9 +91,7 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
findPt: L L Pt -> Union(Pt,"failed")
Pnan?:Pt ->Boolean
- Fnan?(x: SF): Boolean == %fNaN?(x)$Foreign(Builtin)
-
- Pnan? p == any?(Fnan?,p)
+ Pnan? p == any?(nan?,p)
iClipParametric(pointLists,fraction,scale) ==
import Point SF
@@ -224,8 +222,8 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
-- throw out points with large and small y-coordinates
yMin := yCoord(sortedList.clipNum)
yMax := yCoord(sortedList.(n - 1 - clipNum))
- if Fnan? yMin then yMin : SF := 0
- if Fnan? yMax then yMax : SF := 0
+ if nan? yMin then yMin : SF := 0
+ if nan? yMax then yMax : SF := 0
(yDiff := yMax - yMin) = 0 =>
[pointLists,xRange plot,segment(yMin - 1,yMax + 1)]
numm := numer scale; denn := denom scale
@@ -236,11 +234,11 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
(yCoord(#1) < yMax) and (yCoord(#1) > yMin),xMin,xMax,yMin,yMax)
yMin := yCoord(sortedList.clipNum)
yMax := yCoord(sortedList.(n - 1 - clipNum))
- if Fnan? yMin then yMin : SF := 0
- if Fnan? yMax then yMax : SF := 0
+ if nan? yMin then yMin : SF := 0
+ if nan? yMax then yMax : SF := 0
for list in lists repeat
for pt in list repeat
- if not Fnan?(yCoord pt) then
+ if not nan?(yCoord pt) then
yMin := min(yMin,yCoord pt)
yMax := max(yMax,yCoord pt)
[lists,xVals,segment(yMin,yMax)]
@@ -249,13 +247,13 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
norm(pt) ==
x := xCoord(pt); y := yCoord(pt)
- if Fnan? x then
- if Fnan? y then
+ if nan? x then
+ if nan? y then
r:SF := 0
else
r:SF := y**2
else
- if Fnan? y then
+ if nan? y then
r:SF := x**2
else
r:SF := x**2 + y**2
diff --git a/src/algebra/plot.spad.pamphlet b/src/algebra/plot.spad.pamphlet
index 4d3208fc..1bb17da9 100644
--- a/src/algebra/plot.spad.pamphlet
+++ b/src/algebra/plot.spad.pamphlet
@@ -174,8 +174,7 @@ Plot(): Exports == Implementation where
ANGLEBOUND: F := cos inv (4::F)
DEBUG: B := false
- Fnan?(x: F): Boolean == %fNaN?(x)$Foreign(Builtin)
- Pnan?(x) == any?(Fnan?,x)
+ Pnan?(x) == any?(nan?,x)
--% graphics output
@@ -236,11 +235,11 @@ Plot(): Exports == Implementation where
select(l,f,g) ==
m := f first l
- if Fnan? m then m := 0
+ if nan? m then m := 0
for p in rest l repeat
n := m
m := g(m, f p)
- if Fnan? m then m := n
+ if nan? m then m := n
m
rangeRefine(curve,nRange) ==
diff --git a/src/algebra/sf.spad.pamphlet b/src/algebra/sf.spad.pamphlet
index ce5b6032..a6ed7e59 100644
--- a/src/algebra/sf.spad.pamphlet
+++ b/src/algebra/sf.spad.pamphlet
@@ -209,6 +209,7 @@ FloatingPointSystem(): Category == RealNumberSystem() with
++ Author: Michael Monagan
++ Date Created:
++ January 1988
+++ Date Last Modified: June 26, 2011.
++ Change History:
++ Basic Operations: exp1, hash, log2, log10, rationalApproximation, / , **
++ Related Constructors:
@@ -274,6 +275,9 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath,
++ rationalApproximation(f, n, b) computes a rational
++ approximation r to f with relative error \spad{< b**(-n)}
++ (that is, \spad{|(r-f)/f| < b**(-n)}).
+ nan?: % -> Boolean
+ ++ \spad{nan? x} holds if \spad{x} is a Not a Number floating
+ ++ point data in the IEEE 754 sense.
== add
macro MER == Record(MANTISSA:Integer,EXPONENT:Integer)
@@ -322,6 +326,7 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath,
import %facosh: % -> % from Foreign Builtin
import %fatanh: % -> % from Foreign Builtin
import %fcstpi: () -> % from Foreign Builtin
+ import %fNaN?: % -> Boolean from Foreign Builtin
manexp: % -> MER
@@ -537,6 +542,7 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath,
d = 2 => sqrt(x) ** n
x ** (n::% / d::%)
+ nan? x == %fNaN? x
@
\section{License}