diff options
author | dos-reis <gdr@axiomatics.org> | 2011-06-20 10:42:25 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-06-20 10:42:25 +0000 |
commit | e4656a0388e8fa12594788b216b42bb04680d9d5 (patch) | |
tree | 3eb1e106e8344ca276b44fae4a489c0813efa92a /src/algebra | |
parent | e1925b37c7601d37bfa5d624d428ea40f3708c8f (diff) | |
download | open-axiom-e4656a0388e8fa12594788b216b42bb04680d9d5.tar.gz |
* interp/spaderror.lisp ($numericFailure): Remove.
(trapNumericErrors): Define for non-GCL RTS.
Tidy GCL-based definition.
* algebra/draw.spad.pamphlet: trapNumericErrors now returns a
value of type Maybe T.
* algebra/plot.spad.pamphlet: Likewise.
* algebra/plot3d.spad.pamphlet: Likewise.
Diffstat (limited to 'src/algebra')
-rw-r--r-- | src/algebra/draw.spad.pamphlet | 16 | ||||
-rw-r--r-- | src/algebra/plot.spad.pamphlet | 6 | ||||
-rw-r--r-- | src/algebra/plot3d.spad.pamphlet | 9 |
3 files changed, 14 insertions, 17 deletions
diff --git a/src/algebra/draw.spad.pamphlet b/src/algebra/draw.spad.pamphlet index b5e7bae8..f145330d 100644 --- a/src/algebra/draw.spad.pamphlet +++ b/src/algebra/draw.spad.pamphlet @@ -318,10 +318,10 @@ TopLevelDrawFunctionsForCompiledFunctions(): myTrap1: (SF-> SF, SF) -> SF myTrap1(ff:SF-> SF, f:SF):SF == - s := trapNumericErrors(ff(f))$Lisp :: Union(SF, "failed") - s case "failed" => quietDoubleNaN()$Foreign(Builtin) - r:=s::SF - r >max()$SF or r < min()$SF => quietDoubleNaN()$Foreign(Builtin) + s: Maybe SF := trapNumericErrors(ff(f))$Lisp + s case nothing => quietDoubleNaN()$Foreign(Builtin) + r := s@SF + r > max()$SF or r < min()$SF => quietDoubleNaN()$Foreign(Builtin) r makePt2: (SF,SF) -> Point SF @@ -493,10 +493,10 @@ TopLevelDrawFunctionsForCompiledFunctions(): myTrap2: ((SF, SF) -> SF, SF, SF) -> SF myTrap2(ff:(SF, SF) -> SF, u:SF, v:SF):SF == - s := trapNumericErrors(ff(u, v))$Lisp :: Union(SF, "failed") - s case "failed" => quietDoubleNaN()$Foreign(Builtin) - r:SF := s::SF - r >max()$SF or r < min()$SF => quietDoubleNaN()$Foreign(Builtin) + s: Maybe SF := trapNumericErrors(ff(u, v))$Lisp + s case nothing => quietDoubleNaN()$Foreign(Builtin) + r := s@SF + r > max()$SF or r < min()$SF => quietDoubleNaN()$Foreign(Builtin) r recolor(ptFunc,colFunc) == diff --git a/src/algebra/plot.spad.pamphlet b/src/algebra/plot.spad.pamphlet index d03da277..664e3036 100644 --- a/src/algebra/plot.spad.pamphlet +++ b/src/algebra/plot.spad.pamphlet @@ -476,9 +476,9 @@ Plot(): Exports == Implementation where myTrap: (F-> F, F) -> F myTrap(ff:F-> F, f:F):F == - s := trapNumericErrors(ff(f))$Lisp :: Union(F, "failed") - s case "failed" => quietDoubleNaN()$Lisp - r:F:=s::F + s: Maybe F := trapNumericErrors(ff(f))$Lisp + s case nothing => quietDoubleNaN()$Lisp + r:F := s@F r > max()$F or r < min()$F => quietDoubleNaN()$Lisp r diff --git a/src/algebra/plot3d.spad.pamphlet b/src/algebra/plot3d.spad.pamphlet index aa98d794..1ea091a3 100644 --- a/src/algebra/plot3d.spad.pamphlet +++ b/src/algebra/plot3d.spad.pamphlet @@ -445,12 +445,9 @@ Plot3D(): Exports == Implementation where myTrap: (F-> F, F) -> F myTrap(ff:F-> F, f:F):F == - s := trapNumericErrors(ff(f))$Lisp :: Union(F, "failed") - if (s) case "failed" then - r:F := quietDoubleNaN()$Lisp - else - r:F := s - r + s: Maybe F := trapNumericErrors(ff(f))$Lisp + s case nothing => quietDoubleNaN()$Lisp + s plot(f1:F -> F,f2:F -> F,f3:F -> F,col:F -> F,tRange:R) == p := basicPlot(point(myTrap(f1,#1),myTrap(f2,#1),myTrap(f3,#1),col(#1)),tRange) |