# source:project/wiki/eggref/4/mathh@13569

Last change on this file since 13569 was 13569, checked in by Kon Lovett, 12 years ago

Doc for mathh save.

File size: 4.0 KB
Line
1[[tags: egg]]
2
3== mathh
4
5[[toc:]]
6
7
8== Documentation
9
10Provides access to ISO C math functions in <math.h> that are not defined by
11the Chicken core.
12
13
14=== Floating-point Functions
15
16The following procedures are provided, with their usual meaning:
17
18{{N}}, {{N1}}, {{N2}} are {{double}}.
19
20{{O}}, {{P2} are {{integer}}.
21
22==== bessel-j0
23==== bessel-j1
24==== bessel-jn
25==== bessel-jn
26==== bessel-y0
27==== bessel-y1
28==== bessel-yn
29
30<procedure>(bessel-j0 N) => NUMBER</procedure>
31<procedure>(bessel-j1 N) => NUMBER</procedure>
32<procedure>(bessel-jn O N) => NUMBER</procedure>
33<procedure>(bessel-y0 N) => NUMBER</procedure>
34<procedure>(bessel-y1 N) => NUMBER</procedure>
35<procedure>(bessel-yn O N) => NUMBER</procedure>
36
37The Bessel functions are prefixed by 'bessel-' to distinguish the names from
38common variables.
39
40==== cosh
41==== sinh
42==== tanh
43==== hypot
44
45<procedure>(cosh N) => NUMBER</procedure>
46<procedure>(sinh N) => NUMBER</procedure>
47<procedure>(tanh N) => NUMBER</procedure>
48<procedure>(hypot N1 N2) => NUMBER</procedure>
49
50==== gamma
51==== lgamma
52
53<procedure>(gamma N) => NUMBER</procedure>
54<procedure>(lgamma N) => NUMBER</procedure>
55
56{{gamma}} and {{lgamma}} are unavailable on {{Windows}}.
57
58==== log10
59==== log2
60==== log1p
61
62<procedure>(log10 N) => NUMBER</procedure>
63<procedure>(log2 N) => NUMBER</procedure>
64<procedure>(log1p N) => NUMBER</procedure>
65
66{{log1p}} is potentially inaccurate on {{Windows}}.
67
68==== ldexp
69==== scalbn
70
71<procedure>(ldexp N P2) => NUMBER</procedure>
72<procedure>(scalbn N P2) => NUMBER</procedure>
73
74{{scalbn}} is inefficient on {{Windows}}.
75
76==== make-log/base
77
78<procedure>(make-log/base BASE) => PROCEDURE/1-NUMBER</procedure>
79
80Returns a procedure of one argument, the logarithm function for {{BASE}}.
81
82{{BASE}} is a {{number}}.
83
84==== fpmod
85
86<procedure>(fpmod N M) => NUMBER</procedure>
87
88Returns the modulus of {{N}} for {{M}}.
89
90{{N}} and {{M}} are {{double}}.
91
92==== modf
93
94<procedure>(modf N) => (values NUMBER NUMBER)</procedure>
95
96Returns two values, the integral and fractional components of {{N}}.
97
98{{N}} is {{double}}.
99
100==== frexp
101
102<procedure>(frexp N) => (values NUMBER NUMBER)</procedure>
103
104Returns two values, the fraction and the exponent components of {{N}}.
105
106{{N}} is {{double}}.
107
108
109=== Float Classification
110
111(procedure (fpclassify N))
112
113Returns a symbol denoting the floating-point kind of {{N}}.
114
115{{N}} is {{double}}.
116
117; infinite :
118; nan :
119; normal :
120; subnormal :
121; zero :
122; unclassified :
123
124(procedure (fpclass N))
125
126Returns a symbol denoting the floating-point kind of {{N}}.
127
128{{N}} is {{double}}.
129
130; positive-infinite :
131; negative-infinite :
132; quiet-nan :
133; signaling-nan :
134; positive-normal :
135; negative-normal :
136; positive-subnormal :
137; negative-subnormal :
138; positive-zero :
139; negative-zero :
140; unclassified :
141
142
143=== Math Constants
144
145Common constants, using 'define-constant'. As such they must be textually
146included.
147
148; E : e
149; 1/E : 1/e
150; E^2 : e^2
151; E^PI/4 : e^(pi/4)
152; LOG2E : log2(e)
153; LOG10E : log10(e)
154; LN2 : log(2)
155; LN3 : ln(3)
156; LNPI : ln(pi)
157; LN10 : log(10)
158; 1/LN2 : 1/ln(2)
159; 1/LN10 : 1/ln(10)
160; PI : pi
161; PI/2 : pi/2
162; PI/4 : pi/4
163; 1/PI : 1/pi
164; 2/PI : 2/pi
165; 2/SQRTPI : 2/sqrt(pi)
166; SQRTPI : sqrt(pi)
167; PI^2 : pi^2
168; DEGREE : pi/180
169; SQRT2 : sqrt(2)
170; 1/SQRT2 : 1/sqrt(2)
171; SQRT3 : sqrt(3)
172; SQRT5 : sqrt(5)
173; SQRT10 : sqrt(10)
174; CUBERT2 : cubert(2)
175; CUBERT3 : cubert(3)
176; 4THRT2 : fourthrt(2)
177; GAMMA1/2 : gamma(1/2)
178; GAMMA1/3 : gamma(1/3)
179; GAMMA2/3 : gamma(2/3)
180; PHI : phi
181; LNPHI : ln(phi)
182; 1/LNPHI : 1/ln(phi)
183; EULER : euler
184; E^EULER : e^euler
185; SIN1 : sin(1)
186; COS1 : cos(1)
187; ZETA3 : theta(3
188
189
190== Usage
191
192=== Math functions
193
194<enscript language=scheme>
195(require-library mathh)
196(import mathh)
197</enscript>
198
199or
200
201<enscript language=scheme>
202(require-extension mathh)
203</enscript>
204
205=== Math constants
206
207<enscript language=scheme>
208(include mathh-constants)
209</enscript>
210
211
212== Examples
213
214
215== Notes
216
217
218== Requirements
219
220
221== Bugs and Limitations
222
223
224== Author
225
226[[kon lovett]] and [[john cowan]]
227
228
229== Version history
230
231; 2.0.0 : Chicken 4 release. {{fpclass}} and {{fpclassify}} are now part of the '''mathh''' extension.
232
233