From 17004f202c892fd4d933b94c6b7441c45a06e80b Mon Sep 17 00:00:00 2001 From: dos-reis Date: Thu, 29 Jul 2010 15:43:35 +0000 Subject: * algebra/sf.spad.pamphlet (DoubleFloat): Use builtin trigonometric functions. * interp/g-opt.boot ($VMsideEffectFreeOperators): Include them. * interp/g-util.boot: Expand them. * include/edible.H1: Move declarations to clef/edible.c. Remove. * driver/utils.h: Give G linkage to declarations. * sman/Makefile.in: Link programs against C++ runtime. --- src/algebra/sf.spad.pamphlet | 51 +++++++++++++++++++++++++++++--------------- src/algebra/strap/DFLOAT.lsp | 36 +++++++++++++++---------------- 2 files changed, 52 insertions(+), 35 deletions(-) (limited to 'src/algebra') diff --git a/src/algebra/sf.spad.pamphlet b/src/algebra/sf.spad.pamphlet index 1b51d3a0..1585af6a 100644 --- a/src/algebra/sf.spad.pamphlet +++ b/src/algebra/sf.spad.pamphlet @@ -279,6 +279,7 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath, == add MER ==> Record(MANTISSA:Integer,EXPONENT:Integer) + import %hash: % -> SingleInteger from Foreign Builtin import %fminval: () -> % from Foreign Builtin import %fmaxval: () -> % from Foreign Builtin import %fbase: () -> PositiveInteger from Foreign Builtin @@ -298,6 +299,22 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath, import %fle: (%,%) -> Boolean from Foreign Builtin import %fgt: (%,%) -> Boolean from Foreign Builtin import %fge: (%,%) -> Boolean from Foreign Builtin + import %fsin: % -> % from Foreign Builtin + import %fcos: % -> % from Foreign Builtin + import %ftan: % -> % from Foreign Builtin + import %fcot: % -> % from Foreign Builtin + import %fsec: % -> % from Foreign Builtin + import %fcsc: % -> % from Foreign Builtin + import %fatan: % -> % from Foreign Builtin + import %facot: % -> % from Foreign Builtin + import %fsinh: % -> % from Foreign Builtin + import %fcosh: % -> % from Foreign Builtin + import %ftanh: % -> % from Foreign Builtin + import %fcsch: % -> % from Foreign Builtin + import %fcoth: % -> % from Foreign Builtin + import %fsech: % -> % from Foreign Builtin + import %fasinh: % -> % from Foreign Builtin + import %facsch: % -> % from Foreign Builtin manexp: % -> MER @@ -381,35 +398,35 @@ DoubleFloat(): Join(FloatingPointSystem, DifferentialRing, OpenMath, exp x == EXP(x)$Lisp log x == checkComplex LN(x)$Lisp log2 x == checkComplex LOG2(x)$Lisp - sin x == SIN(x)$Lisp - cos x == COS(x)$Lisp - tan x == TAN(x)$Lisp - cot x == COT(x)$Lisp - sec x == SEC(x)$Lisp - csc x == CSC(x)$Lisp + sin x == %fsin x + cos x == %fcos x + tan x == %ftan x + cot x == %fcot x + sec x == %fsec x + csc x == %fcsc x asin x == checkComplex ASIN(x)$Lisp -- can be complex acos x == checkComplex ACOS(x)$Lisp -- can be complex - atan x == ATAN(x)$Lisp + atan x == %fatan x acsc x == checkComplex ACSC(x)$Lisp - acot x == ACOT(x)$Lisp + acot x == %facot x asec x == checkComplex ASEC(x)$Lisp - sinh x == SINH(x)$Lisp - cosh x == COSH(x)$Lisp - tanh x == TANH(x)$Lisp - csch x == CSCH(x)$Lisp - coth x == COTH(x)$Lisp - sech x == SECH(x)$Lisp - asinh x == ASINH(x)$Lisp + sinh x == %fsinh x + cosh x == %fcosh x + tanh x == %ftanh x + csch x == %fcsch x + coth x == %fcoth x + sech x == %fsech x + asinh x == %fasinh x acosh x == checkComplex ACOSH(x)$Lisp -- can be complex atanh x == checkComplex ATANH(x)$Lisp -- can be complex - acsch x == ACSCH(x)$Lisp + acsch x == %facsch x acoth x == checkComplex ACOTH(x)$Lisp asech x == checkComplex ASECH(x)$Lisp x:% / y:% == %fdiv(x,y) negative? x == x < 0 zero? x == x = 0 one? x == x = 1 - hash x == HASHEQ(x)$Lisp + hash x == %hash x recip(x) == (zero? x => "failed"; 1 / x) differentiate x == 0 diff --git a/src/algebra/strap/DFLOAT.lsp b/src/algebra/strap/DFLOAT.lsp index 6ce53de0..0736ea62 100644 --- a/src/algebra/strap/DFLOAT.lsp +++ b/src/algebra/strap/DFLOAT.lsp @@ -184,32 +184,32 @@ (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;sin;2$;41|)) -(PUT '|DFLOAT;sin;2$;41| '|SPADreplace| 'SIN) +(PUT '|DFLOAT;sin;2$;41| '|SPADreplace| '|%fsin|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;cos;2$;42|)) -(PUT '|DFLOAT;cos;2$;42| '|SPADreplace| 'COS) +(PUT '|DFLOAT;cos;2$;42| '|SPADreplace| '|%fcos|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;tan;2$;43|)) -(PUT '|DFLOAT;tan;2$;43| '|SPADreplace| 'TAN) +(PUT '|DFLOAT;tan;2$;43| '|SPADreplace| '|%ftan|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;cot;2$;44|)) -(PUT '|DFLOAT;cot;2$;44| '|SPADreplace| 'COT) +(PUT '|DFLOAT;cot;2$;44| '|SPADreplace| '|%fcot|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;sec;2$;45|)) -(PUT '|DFLOAT;sec;2$;45| '|SPADreplace| 'SEC) +(PUT '|DFLOAT;sec;2$;45| '|SPADreplace| '|%fsec|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;csc;2$;46|)) -(PUT '|DFLOAT;csc;2$;46| '|SPADreplace| 'CSC) +(PUT '|DFLOAT;csc;2$;46| '|SPADreplace| '|%fcsc|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;asin;2$;47|)) @@ -220,7 +220,7 @@ (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;atan;2$;49|)) -(PUT '|DFLOAT;atan;2$;49| '|SPADreplace| 'ATAN) +(PUT '|DFLOAT;atan;2$;49| '|SPADreplace| '|%fatan|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;acsc;2$;50|)) @@ -228,7 +228,7 @@ (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;acot;2$;51|)) -(PUT '|DFLOAT;acot;2$;51| '|SPADreplace| 'ACOT) +(PUT '|DFLOAT;acot;2$;51| '|SPADreplace| '|%facot|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;asec;2$;52|)) @@ -236,37 +236,37 @@ (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;sinh;2$;53|)) -(PUT '|DFLOAT;sinh;2$;53| '|SPADreplace| 'SINH) +(PUT '|DFLOAT;sinh;2$;53| '|SPADreplace| '|%fsinh|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;cosh;2$;54|)) -(PUT '|DFLOAT;cosh;2$;54| '|SPADreplace| 'COSH) +(PUT '|DFLOAT;cosh;2$;54| '|SPADreplace| '|%fcosh|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;tanh;2$;55|)) -(PUT '|DFLOAT;tanh;2$;55| '|SPADreplace| 'TANH) +(PUT '|DFLOAT;tanh;2$;55| '|SPADreplace| '|%ftanh|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;csch;2$;56|)) -(PUT '|DFLOAT;csch;2$;56| '|SPADreplace| 'CSCH) +(PUT '|DFLOAT;csch;2$;56| '|SPADreplace| '|%fcsch|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;coth;2$;57|)) -(PUT '|DFLOAT;coth;2$;57| '|SPADreplace| 'COTH) +(PUT '|DFLOAT;coth;2$;57| '|SPADreplace| '|%fcoth|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;sech;2$;58|)) -(PUT '|DFLOAT;sech;2$;58| '|SPADreplace| 'SECH) +(PUT '|DFLOAT;sech;2$;58| '|SPADreplace| '|%fsech|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;asinh;2$;59|)) -(PUT '|DFLOAT;asinh;2$;59| '|SPADreplace| 'ASINH) +(PUT '|DFLOAT;asinh;2$;59| '|SPADreplace| '|%fasinh|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;acosh;2$;60|)) @@ -277,7 +277,7 @@ (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;acsch;2$;62|)) -(PUT '|DFLOAT;acsch;2$;62| '|SPADreplace| 'ACSCH) +(PUT '|DFLOAT;acsch;2$;62| '|SPADreplace| '|%facsch|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%DoubleFloat|) |DFLOAT;acoth;2$;63|)) @@ -303,7 +303,7 @@ (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%Short|) |DFLOAT;hash;$Si;69|)) -(PUT '|DFLOAT;hash;$Si;69| '|SPADreplace| 'HASHEQ) +(PUT '|DFLOAT;hash;$Si;69| '|SPADreplace| '|%hash|) (DECLAIM (FTYPE (FUNCTION (|%DoubleFloat| |%Shell|) |%Pair|) |DFLOAT;recip;$U;70|)) @@ -590,7 +590,7 @@ (DEFUN |DFLOAT;one?;$B;68| (|x| $) (DECLARE (IGNORE $)) (= |x| 1.0)) -(DEFUN |DFLOAT;hash;$Si;69| (|x| $) (DECLARE (IGNORE $)) (HASHEQ |x|)) +(DEFUN |DFLOAT;hash;$Si;69| (|x| $) (DECLARE (IGNORE $)) (SXHASH |x|)) (DEFUN |DFLOAT;recip;$U;70| (|x| $) (COND ((ZEROP |x|) (CONS 1 "failed")) (T (CONS 0 (/ 1.0 |x|))))) -- cgit v1.2.3