home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2238 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  55.1 KB

  1. From: glenn@extro.ucc.su.OZ.AU (Glenn Geers)
  2. Newsgroups: alt.sources
  3. Subject: 80386 alternative math library part01/04
  4. Message-ID: <1990Dec7.215414.323@metro.ucc.su.OZ.AU>
  5. Date: 7 Dec 90 21:54:14 GMT
  6.  
  7. Here is my alternative math library for the 80386/80387. You need gcc/gas
  8. in order to compile it but you can link with code compiled with cc.
  9.  
  10. I will post this to comp.sources.misc when that group starts running at speed
  11. again.
  12.                 Glenn
  13.  
  14. Submitted-by: glenn@trantor
  15. Archive-name: libfpu/part01
  16.  
  17. #!/bin/sh
  18. # This is libfpu, a shell archive (shar 3.47)
  19. # made 12/07/1990 20:56 UTC by glenn@trantor
  20. # Source directory /usr1/src/math/dist
  21. #
  22. # existing files will NOT be overwritten unless -c is specified
  23. #
  24. # This shar contains:
  25. # length  mode       name
  26. # ------ ---------- ------------------------------------------
  27. #   3702 -rw-r--r-- CHANGELOG
  28. #  12488 -rw-r--r-- COPYING
  29. #    316 -rw-r--r-- COPYRIGHT
  30. #   1984 -rw-r--r-- Makefile
  31. #    295 -rw-r--r-- PROBLEMS
  32. #   9579 -rw-r--r-- README
  33. #    244 -rw-r--r-- TODO
  34. #    320 -rw-r--r-- _getsw.s
  35. #    544 -rw-r--r-- acos.s
  36. #    398 -rw-r--r-- acosh.s
  37. #    401 -rw-r--r-- asin.s
  38. #    397 -rw-r--r-- asinh.s
  39. #    331 -rw-r--r-- atan.s
  40. #    931 -rw-r--r-- atan2.s
  41. #    438 -rw-r--r-- atanh.s
  42. #    682 -rw-r--r-- ceil.s
  43. #    555 -rw-r--r-- copysign.s
  44. #    320 -rw-r--r-- cos.s
  45. #    486 -rw-r--r-- cosh.s
  46. #   3424 -rw-r--r-- d2dcomb.summ
  47. #    381 -rw-r--r-- drem.s
  48. #   2681 -rw-r--r-- erf.c
  49. #    400 -rw-r--r-- exp.s
  50. #    404 -rw-r--r-- exp10.s
  51. #    387 -rw-r--r-- exp2.s
  52. #    418 -rw-r--r-- expm1.s
  53. #    322 -rw-r--r-- fabs.s
  54. #    447 -rw-r--r-- finite.s
  55. #    628 -rw-r--r-- floor.s
  56. #    380 -rw-r--r-- fmod.s
  57. #   2314 -rw-r--r-- fpumath.h
  58. #    604 -rw-r--r-- gamma.c
  59. #    377 -rw-r--r-- hypot.s
  60. #   1977 -rw-r--r-- ieee_ext.s
  61. #    853 -rw-r--r-- ieee_retro.c
  62. #   1295 -rw-r--r-- ieee_values.s
  63. #    394 -rw-r--r-- infinity.s
  64. #   5099 -rw-r--r-- j0.c
  65. #   5169 -rw-r--r-- j1.c
  66. #   2310 -rw-r--r-- jn.c
  67. #   3382 -rw-r--r-- lgamma.c
  68. #    329 -rw-r--r-- log.s
  69. #    333 -rw-r--r-- log10.s
  70. #    346 -rw-r--r-- log1p.s
  71. #    329 -rw-r--r-- log2.s
  72. #    339 -rw-r--r-- logb.s
  73. #   2996 -rw-r--r-- mathimpl.h
  74. #   1392 -rw-r--r-- nextafter.c
  75. #  57545 -rw-r--r-- paranoia.c
  76. #   2128 -rw-r--r-- pow.s
  77. #    326 -rw-r--r-- rint.s
  78. #    343 -rw-r--r-- scalb.s
  79. #    377 -rw-r--r-- setcont.s
  80. #    449 -rw-r--r-- setinternal.s
  81. #    320 -rw-r--r-- sin.s
  82. #    487 -rw-r--r-- sinh.s
  83. #    359 -rw-r--r-- sqrt.s
  84. #    605 -rw-r--r-- sqrtp.s
  85. #    334 -rw-r--r-- tan.s
  86. #    493 -rw-r--r-- tanh.s
  87. #
  88. # ============= CHANGELOG ==============
  89. if test -f 'CHANGELOG' -a X"$1" != X"-c"; then
  90.     echo 'x - skipping CHANGELOG (File already exists)'
  91. else
  92. echo 'x - extracting CHANGELOG (Text)'
  93. sed 's/^X//' << 'SHAR_EOF' > 'CHANGELOG' &&
  94. Thu Nov 15 07:05:39 EDT 1990
  95. Shar'd beta version for release to testers.
  96. X
  97. Sat Nov 17 17:06:17 EDT 1990
  98. Fixed floor and ceil so that they address their local variables at -ve
  99. offsets relative to the frame pointer.
  100. X
  101. Fixed hypot.s so that unnecessary register loads are avoided. I wasn't aware
  102. of the correct assembler mnemonic to multiply %st(0) by the contents of a memory
  103. location.
  104. X
  105. Sat Nov 17 18:49:31 EDT 1990
  106. Copysign rewritten in assembler.
  107. X
  108. Sun Nov 18 11:21:24 EDT 1990
  109. Sinh and cosh now in assembler.
  110. Tanh now in assembler.
  111. Fixed nasty bug in acos.s.
  112. exp__E no longer needed - source deleted.
  113. X
  114. Tue Nov 20 21:24:26 EDT 1990
  115. Sinh and cosh now multiply by 0.5 instead of dividing by 2. It's faster.
  116. Added setinternal for convenience in some cases. Using this makes the
  117. output of paranoia closer to that obtained on a Sun 4.
  118. Added setcont.
  119. Modified the Makefile so that test and paranoia are synonymous.
  120. Modified atan2.c to avoid a floating point register load.
  121. Fixed bug in atan2 - was giving incorrect result when y/x = +/-inf.
  122. X
  123. Thu Nov 22 06:52:47 EDT 1990
  124. Fixed local variable handling in assembler files. Stack needs to be 
  125. allocated for local variables.
  126. All assembler routines are now .align 4.
  127. X
  128. Thu Nov 22 19:24:09 EDT 1990
  129. Added MASK_ALL to fpumath.h
  130. X
  131. Fri Nov 23 21:11:33 EDT 1990
  132. Inverse hyperbolics missing from fpumath.h - fixed.
  133. Some definitions missing from atanh.c - didn't work on some systems.
  134. Coded inverse hyperbolics in assembler.
  135. Coded atan2 in assembler.
  136. X
  137. Sat Nov 24 17:12:34 EDT 1990
  138. Modified hypot.s to avoid use of ffree.
  139. atan2 was not working correctly - fixed
  140. Ready for netwide release.
  141. X
  142. Mon Nov 26 19:25:56 EDT 1990
  143. Put in explicit call to cc for compiling lgamma. This means that the
  144. library can link to code not compiled with gcc (not quite true pow.s has to be
  145. changed).
  146. X
  147. Wed Nov 28 22:57:43 EDT 1990
  148. Coded the is??? functions required for IEEE conformance
  149. Coded ieee_retrospective() which prints a summary of IEEE exceptions that are on
  150. when the function is called.
  151. X
  152. Fri Nov 30 17:35:29 EDT 1990
  153. Removed the last vestige of GNU specifics. You can now use the library with 'cc'
  154. although you need gcc/gas to create it.
  155. X
  156. Sat Dec  1 15:48:19 EDT 1990
  157. Found a bug in pow (pow(-x,x) shoudn't work for x non-integral) fixed.
  158. X
  159. Sat Dec  1 21:00:48 EST 1990
  160. Rewrote copysign in a more efficient way.
  161. X
  162. Sun Dec  2 06:51:59 EDT 1990
  163. Added infinity().
  164. Amended README to show the current state.
  165. Changed fpumath.h so as to define HUGE = infinity() if you compile (user
  166. code) with IEEE defined.
  167. X
  168. Sun Dec  2 08:26:20 EDT 1990
  169. Modified log functions and inverse hyperbolics for greater accuracy.
  170. X
  171. Sun Dec  2 10:08:47 EDT 1990
  172. Added MASK_ALL1 to fpumath.h. This enables 64 bit precision significands.
  173. Coded sqrtp to ensure that sqrt is rounded to 53 bits - used in
  174. paranoia.c.
  175. Put sqrtp in fpumath.h and in README.
  176. Made very minor changes to pow.s, floor.s and ceil.s.
  177. ieee_retrospective was printing its leading info for a LOS exception -
  178. fixed.
  179. Rewrote finite so that it does not use the floating point unit and so does
  180. not raise any exceptions.
  181. Produced d2dcomb.summ.
  182. X
  183. Sun Dec  2 18:40:47 EDT 1990
  184. Fixed exp, exp10, expm1, exp2, sinh, cosh, tanh to gain more speed.
  185. X
  186. Wed Dec  5 17:25:50 EDT 1990
  187. Coded max_..., min_..., etc.
  188. X
  189. Wed Dec  5 19:38:56 EDT 1990
  190. Fixed some local parameter handling errors in a few of the assembler
  191. files.
  192. X
  193. Wed Dec  5 20:54:37 EDT 1990
  194. Define MAX(MIN)DOUBLE in terms of max(min)_(sub)normal in fpumath.h.
  195. X
  196. Sat Dec  8 06:09:01 EDT 1990
  197. Fixed bug in isnan 8(%ebp) not $8(%ebp) - typo!
  198. Fixed bug in isinf - not doing correct test.
  199. X
  200. Sat Dec  8 06:36:07 EDT 1990
  201. Coded nextafter.
  202. X
  203. Sat Dec  8 06:46:44 EDT 1990
  204. MAXDOUBLE is wrong in math.h it is correct in fpumath.h
  205. SHAR_EOF
  206. chmod 0644 CHANGELOG ||
  207. echo 'restore of CHANGELOG failed'
  208. Wc_c="`wc -c < 'CHANGELOG'`"
  209. test 3702 -eq "$Wc_c" ||
  210.     echo 'CHANGELOG: original size 3702, current size' "$Wc_c"
  211. fi
  212. # ============= COPYING ==============
  213. if test -f 'COPYING' -a X"$1" != X"-c"; then
  214.     echo 'x - skipping COPYING (File already exists)'
  215. else
  216. echo 'x - extracting COPYING (Text)'
  217. sed 's/^X//' << 'SHAR_EOF' > 'COPYING' &&
  218. X
  219. X            GNU GENERAL PUBLIC LICENSE
  220. X             Version 1, February 1989
  221. X
  222. X Copyright (C) 1989 Free Software Foundation, Inc.
  223. X                    675 Mass Ave, Cambridge, MA 02139, USA
  224. X Everyone is permitted to copy and distribute verbatim copies
  225. X of this license document, but changing it is not allowed.
  226. X
  227. X                Preamble
  228. X
  229. X  The license agreements of most software companies try to keep users
  230. at the mercy of those companies.  By contrast, our General Public
  231. License is intended to guarantee your freedom to share and change free
  232. software--to make sure the software is free for all its users.  The
  233. General Public License applies to the Free Software Foundation's
  234. software and to any other program whose authors commit to using it.
  235. You can use it for your programs, too.
  236. X
  237. X  When we speak of free software, we are referring to freedom, not
  238. price.  Specifically, the General Public License is designed to make
  239. sure that you have the freedom to give away or sell copies of free
  240. software, that you receive source code or can get it if you want it,
  241. that you can change the software or use pieces of it in new free
  242. programs; and that you know you can do these things.
  243. X
  244. X  To protect your rights, we need to make restrictions that forbid
  245. anyone to deny you these rights or to ask you to surrender the rights.
  246. These restrictions translate to certain responsibilities for you if you
  247. distribute copies of the software, or if you modify it.
  248. X
  249. X  For example, if you distribute copies of a such a program, whether
  250. gratis or for a fee, you must give the recipients all the rights that
  251. you have.  You must make sure that they, too, receive or can get the
  252. source code.  And you must tell them their rights.
  253. X
  254. X  We protect your rights with two steps: (1) copyright the software, and
  255. (2) offer you this license which gives you legal permission to copy,
  256. distribute and/or modify the software.
  257. X
  258. X  Also, for each author's protection and ours, we want to make certain
  259. that everyone understands that there is no warranty for this free
  260. software.  If the software is modified by someone else and passed on, we
  261. want its recipients to know that what they have is not the original, so
  262. that any problems introduced by others will not reflect on the original
  263. authors' reputations.
  264. X
  265. X  The precise terms and conditions for copying, distribution and
  266. modification follow.
  267. X
  268. X            GNU GENERAL PUBLIC LICENSE
  269. X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  270. X
  271. X  0. This License Agreement applies to any program or other work which
  272. contains a notice placed by the copyright holder saying it may be
  273. distributed under the terms of this General Public License.  The
  274. "Program", below, refers to any such program or work, and a "work based
  275. on the Program" means either the Program or any work containing the
  276. Program or a portion of it, either verbatim or with modifications.  Each
  277. licensee is addressed as "you".
  278. X
  279. X  1. You may copy and distribute verbatim copies of the Program's source
  280. code as you receive it, in any medium, provided that you conspicuously and
  281. appropriately publish on each copy an appropriate copyright notice and
  282. disclaimer of warranty; keep intact all the notices that refer to this
  283. General Public License and to the absence of any warranty; and give any
  284. other recipients of the Program a copy of this General Public License
  285. along with the Program.  You may charge a fee for the physical act of
  286. transferring a copy.
  287. X
  288. X  2. You may modify your copy or copies of the Program or any portion of
  289. it, and copy and distribute such modifications under the terms of Paragraph
  290. 1 above, provided that you also do the following:
  291. X
  292. X    a) cause the modified files to carry prominent notices stating that
  293. X    you changed the files and the date of any change; and
  294. X
  295. X    b) cause the whole of any work that you distribute or publish, that
  296. X    in whole or in part contains the Program or any part thereof, either
  297. X    with or without modifications, to be licensed at no charge to all
  298. X    third parties under the terms of this General Public License (except
  299. X    that you may choose to grant warranty protection to some or all
  300. X    third parties, at your option).
  301. X
  302. X    c) If the modified program normally reads commands interactively when
  303. X    run, you must cause it, when started running for such interactive use
  304. X    in the simplest and most usual way, to print or display an
  305. X    announcement including an appropriate copyright notice and a notice
  306. X    that there is no warranty (or else, saying that you provide a
  307. X    warranty) and that users may redistribute the program under these
  308. X    conditions, and telling the user how to view a copy of this General
  309. X    Public License.
  310. X
  311. X    d) You may charge a fee for the physical act of transferring a
  312. X    copy, and you may at your option offer warranty protection in
  313. X    exchange for a fee.
  314. X
  315. Mere aggregation of another independent work with the Program (or its
  316. derivative) on a volume of a storage or distribution medium does not bring
  317. the other work under the scope of these terms.
  318. X
  319. X  3. You may copy and distribute the Program (or a portion or derivative of
  320. it, under Paragraph 2) in object code or executable form under the terms of
  321. Paragraphs 1 and 2 above provided that you also do one of the following:
  322. X
  323. X    a) accompany it with the complete corresponding machine-readable
  324. X    source code, which must be distributed under the terms of
  325. X    Paragraphs 1 and 2 above; or,
  326. X
  327. X    b) accompany it with a written offer, valid for at least three
  328. X    years, to give any third party free (except for a nominal charge
  329. X    for the cost of distribution) a complete machine-readable copy of the
  330. X    corresponding source code, to be distributed under the terms of
  331. X    Paragraphs 1 and 2 above; or,
  332. X
  333. X    c) accompany it with the information you received as to where the
  334. X    corresponding source code may be obtained.  (This alternative is
  335. X    allowed only for noncommercial distribution and only if you
  336. X    received the program in object code or executable form alone.)
  337. X
  338. Source code for a work means the preferred form of the work for making
  339. modifications to it.  For an executable file, complete source code means
  340. all the source code for all modules it contains; but, as a special
  341. exception, it need not include source code for modules which are standard
  342. libraries that accompany the operating system on which the executable
  343. file runs, or for standard header files or definitions files that
  344. accompany that operating system.
  345. X
  346. X  4. You may not copy, modify, sublicense, distribute or transfer the
  347. Program except as expressly provided under this General Public License.
  348. Any attempt otherwise to copy, modify, sublicense, distribute or transfer
  349. the Program is void, and will automatically terminate your rights to use
  350. the Program under this License.  However, parties who have received
  351. copies, or rights to use copies, from you under this General Public
  352. License will not have their licenses terminated so long as such parties
  353. remain in full compliance.
  354. X
  355. X  5. By copying, distributing or modifying the Program (or any work based
  356. on the Program) you indicate your acceptance of this license to do so,
  357. and all its terms and conditions.
  358. X
  359. X  6. Each time you redistribute the Program (or any work based on the
  360. Program), the recipient automatically receives a license from the original
  361. licensor to copy, distribute or modify the Program subject to these
  362. terms and conditions.  You may not impose any further restrictions on the
  363. recipients' exercise of the rights granted herein.
  364. X
  365. X  7. The Free Software Foundation may publish revised and/or new versions
  366. of the General Public License from time to time.  Such new versions will
  367. be similar in spirit to the present version, but may differ in detail to
  368. address new problems or concerns.
  369. X
  370. Each version is given a distinguishing version number.  If the Program
  371. specifies a version number of the license which applies to it and "any
  372. later version", you have the option of following the terms and conditions
  373. either of that version or of any later version published by the Free
  374. Software Foundation.  If the Program does not specify a version number of
  375. the license, you may choose any version ever published by the Free Software
  376. Foundation.
  377. X
  378. X  8. If you wish to incorporate parts of the Program into other free
  379. programs whose distribution conditions are different, write to the author
  380. to ask for permission.  For software which is copyrighted by the Free
  381. Software Foundation, write to the Free Software Foundation; we sometimes
  382. make exceptions for this.  Our decision will be guided by the two goals
  383. of preserving the free status of all derivatives of our free software and
  384. of promoting the sharing and reuse of software generally.
  385. X
  386. X                NO WARRANTY
  387. X
  388. X  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  389. FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  390. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  391. PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  392. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  393. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  394. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  395. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  396. REPAIR OR CORRECTION.
  397. X
  398. X  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  399. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  400. REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  401. INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  402. OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  403. TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  404. YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  405. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  406. POSSIBILITY OF SUCH DAMAGES.
  407. X
  408. X             END OF TERMS AND CONDITIONS
  409. X
  410. X    Appendix: How to Apply These Terms to Your New Programs
  411. X
  412. X  If you develop a new program, and you want it to be of the greatest
  413. possible use to humanity, the best way to achieve this is to make it
  414. free software which everyone can redistribute and change under these
  415. terms.
  416. X
  417. X  To do so, attach the following notices to the program.  It is safest to
  418. attach them to the start of each source file to most effectively convey
  419. the exclusion of warranty; and each file should have at least the
  420. "copyright" line and a pointer to where the full notice is found.
  421. X
  422. X    <one line to give the program's name and a brief idea of what it does.>
  423. X    Copyright (C) 19yy  <name of author>
  424. X
  425. X    This program is free software; you can redistribute it and/or modify
  426. X    it under the terms of the GNU General Public License as published by
  427. X    the Free Software Foundation; either version 1, or (at your option)
  428. X    any later version.
  429. X
  430. X    This program is distributed in the hope that it will be useful,
  431. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  432. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  433. X    GNU General Public License for more details.
  434. X
  435. X    You should have received a copy of the GNU General Public License
  436. X    along with this program; if not, write to the Free Software
  437. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  438. X
  439. Also add information on how to contact you by electronic and paper mail.
  440. X
  441. If the program is interactive, make it output a short notice like this
  442. when it starts in an interactive mode:
  443. X
  444. X    Gnomovision version 69, Copyright (C) 19xx name of author
  445. X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  446. X    This is free software, and you are welcome to redistribute it
  447. X    under certain conditions; type `show c' for details.
  448. X
  449. The hypothetical commands `show w' and `show c' should show the
  450. appropriate parts of the General Public License.  Of course, the
  451. commands you use may be called something other than `show w' and `show
  452. c'; they could even be mouse-clicks or menu items--whatever suits your
  453. program.
  454. X
  455. You should also get your employer (if you work as a programmer) or your
  456. school, if any, to sign a "copyright disclaimer" for the program, if
  457. necessary.  Here a sample; alter the names:
  458. X
  459. X  Yoyodyne, Inc., hereby disclaims all copyright interest in the
  460. X  program `Gnomovision' (a program to direct compilers to make passes
  461. X  at assemblers) written by James Hacker.
  462. X
  463. X  <signature of Ty Coon>, 1 April 1989
  464. X  Ty Coon, President of Vice
  465. X
  466. That's all there is to it!
  467. SHAR_EOF
  468. chmod 0644 COPYING ||
  469. echo 'restore of COPYING failed'
  470. Wc_c="`wc -c < 'COPYING'`"
  471. test 12488 -eq "$Wc_c" ||
  472.     echo 'COPYING: original size 12488, current size' "$Wc_c"
  473. fi
  474. # ============= COPYRIGHT ==============
  475. if test -f 'COPYRIGHT' -a X"$1" != X"-c"; then
  476.     echo 'x - skipping COPYRIGHT (File already exists)'
  477. else
  478. echo 'x - extracting COPYRIGHT (Text)'
  479. sed 's/^X//' << 'SHAR_EOF' > 'COPYRIGHT' &&
  480. All the assembler source files and the C source files ieee_retro.c and gamma.c
  481. are copyright 1990 to G. Geers.
  482. X
  483. Additional (library) C source and the header mathimpl.h are copyright to 
  484. the Regents of the University of California, Berkley.
  485. X
  486. The original BASIC version of paranoia is copyright Professor W. M. Kahan.
  487. SHAR_EOF
  488. chmod 0644 COPYRIGHT ||
  489. echo 'restore of COPYRIGHT failed'
  490. Wc_c="`wc -c < 'COPYRIGHT'`"
  491. test 316 -eq "$Wc_c" ||
  492.     echo 'COPYRIGHT: original size 316, current size' "$Wc_c"
  493. fi
  494. # ============= Makefile ==============
  495. if test -f 'Makefile' -a X"$1" != X"-c"; then
  496.     echo 'x - skipping Makefile (File already exists)'
  497. else
  498. echo 'x - extracting Makefile (Text)'
  499. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  500. # This file is part of the 80386 alternative math library and is covered by
  501. # the GNU General Public Licence
  502. X
  503. GCC=gcc
  504. CC=cc
  505. CFLAGS=-O -fstrength-reduce
  506. LIBDIR=/lib
  507. INCDIR=/usr/include
  508. # if you want to use setinternal in paranoia; define PTEST
  509. #PTEST=
  510. PTEST=-DTEST
  511. X
  512. .s.o:
  513. X    $(GCC) -c $<
  514. X
  515. .c.o:
  516. X    $(GCC) $(CFLAGS) -c $<
  517. X
  518. CSRC=j0.c lgamma.c gamma.c j1.c erf.c jn.c ieee_retro.c
  519. X
  520. SSRC=acos.s copysign.s drem.s fabs.s hypot.s logb.s scalb.s tan.s \
  521. X    asin.s ceil.s exp.s expm1.s finite.s log.s log1p.s \
  522. X    pow.s sin.s atan.s cos.s exp10.s floor.s log10.s rint.s sqrt.s \
  523. X    exp2.s log2.s sinh.s cosh.s tanh.s setinternal.s setcont.s \
  524. X    asinh.s acosh.s atanh.s atan2.s fmod.s ieee_ext.s _getsw.s \
  525. X    infinity.s sqrtp.s ieee_values.s nextafter.c
  526. X
  527. LIBOBJ=acos.o atanh.o erf.o hypot.o log10.o sin.o \
  528. X       acosh.o ceil.o exp.o j0.o logb.o sinh.o \
  529. X       asin.o copysign.o exp10.o expm1.o j1.o sqrt.o \
  530. X       asinh.o cos.o fabs.o jn.o pow.o tan.o \
  531. X       atan.o cosh.o finite.o lgamma.o rint.o tanh.o \
  532. X       atan2.o drem.o floor.o log.o scalb.o log1p.o gamma.o \
  533. X       exp2.o log2.o setinternal.o setcont.o fmod.o ieee_ext.o \
  534. X       _getsw.o ieee_retro.o infinity.o sqrtp.o ieee_values.o \
  535. X       nextafter.o
  536. X
  537. TESTSRC=paranoia.c
  538. TESTOBJ=paranoia.o 
  539. X
  540. all: libfpu test
  541. X
  542. libfpu: $(LIBOBJ)
  543. X    ar vr libfpu.a $(LIBOBJ)
  544. X
  545. test: libfpu $(TESTOBJ)
  546. X    $(GCC) -o paranoia -DTEST $(TESTOBJ) libfpu.a
  547. X
  548. paranoia: test
  549. X
  550. install: libfpu
  551. X    -cp libfpu.a $(LIBDIR)/libfpu.a
  552. X    -chown bin $(LIBDIR)/libfpu.a
  553. X    -chgrp bin $(LIBDIR)/libfpu.a
  554. X    -chmod 444 $(LIBDIR)/libfpu.a
  555. X    -cp fpumath.h $(INCDIR)/fpumath.h
  556. X
  557. clean:
  558. X    rm -f $(LIBOBJ) $(TESTOBJ) core a.out
  559. X
  560. clobber:
  561. X    rm -f $(LIBOBJ) $(TESTOBJ) libfpu.a paranoia core a.out
  562. X
  563. # Dependencies generated using gcc -MM *.c
  564. erf.o : erf.c 
  565. gamma.o : gamma.c 
  566. j0.o : j0.c mathimpl.h 
  567. j1.o : j1.c mathimpl.h 
  568. jn.o : jn.c mathimpl.h 
  569. lgamma.o : lgamma.c mathimpl.h 
  570. X    $(CC) -O -c lgamma.c
  571. ieee_retro.o : ieee_retro.c
  572. paranoia.o : paranoia.c 
  573. X    $(GCC) -c $(PTEST) paranoia.c
  574. SHAR_EOF
  575. chmod 0644 Makefile ||
  576. echo 'restore of Makefile failed'
  577. Wc_c="`wc -c < 'Makefile'`"
  578. test 1984 -eq "$Wc_c" ||
  579.     echo 'Makefile: original size 1984, current size' "$Wc_c"
  580. fi
  581. # ============= PROBLEMS ==============
  582. if test -f 'PROBLEMS' -a X"$1" != X"-c"; then
  583.     echo 'x - skipping PROBLEMS (File already exists)'
  584. else
  585. echo 'x - extracting PROBLEMS (Text)'
  586. sed 's/^X//' << 'SHAR_EOF' > 'PROBLEMS' &&
  587. exp() (and related exp functions) and pow() give rise to LOS exceptions. I
  588. can't think of any other way of calculating these functions. The results I get
  589. agree with the results from a SUN 4 and with Abramowitz and Stegun 
  590. (to 15 places). If anyone knows of another algorithn please let me know.
  591. SHAR_EOF
  592. chmod 0644 PROBLEMS ||
  593. echo 'restore of PROBLEMS failed'
  594. Wc_c="`wc -c < 'PROBLEMS'`"
  595. test 295 -eq "$Wc_c" ||
  596.     echo 'PROBLEMS: original size 295, current size' "$Wc_c"
  597. fi
  598. # ============= README ==============
  599. if test -f 'README' -a X"$1" != X"-c"; then
  600.     echo 'x - skipping README (File already exists)'
  601. else
  602. echo 'x - extracting README (Text)'
  603. sed 's/^X//' << 'SHAR_EOF' > 'README' &&
  604. VERSION: This is version 1.1
  605. --------
  606. This is version 1.1 of the alternative 386 math library. It supplants
  607. all previous versions. Patches are available against version 1.0 (no
  608. version numbers in 1.0 or beta releases) by anonymous ftp from 
  609. suphys.physics.su.oz.au.
  610. X
  611. X
  612. Introduction
  613. ------------
  614. The files in this directory consist of assembler and C source for an 
  615. alternative maths library for Unices (including Xenix) running on an
  616. 80386/80387 combination and using gcc/gas as the compiler system. These
  617. routines are from 5 to 10 times faster than those in the supplied maths
  618. library; assuming that you're library, like mine (ESIX rev. D and Xenix
  619. 2.3.2), does not use the '387 inbuilts to perform transcendental
  620. calculations.
  621. X
  622. For those of you without a '387 you must use the full emulator and
  623. consequently may not see any speed up. I haven't tried. Under Xenix you
  624. must have a '387---some of the '387 instructions are not emulated. If you
  625. have a '287 your in the same boat; some of the assembler routines won't
  626. work.
  627. X
  628. I have coded the additional IEEE 754 required functions to provide a
  629. conforming double precision implementation. 
  630. X
  631. You require gcc/gas in order to compile the assembler source code.
  632. X
  633. People who are using SUN 386i's (Roadrunner) may also find this useful.
  634. X
  635. File List
  636. ---------
  637. CHANGELOG      atan.s         exp2.s         infinity.s     paranoia.c
  638. COPYING        atan2.s        expm1.s        j0.c           pow.s
  639. COPYRIGHT      atanh.s        fabs.s         j1.c           rint.s
  640. Makefile       ceil.s         finite.s       jn.c           scalb.s
  641. PROBLEMS       copysign.s     floor.s        lgamma.c       setcont.s
  642. README         cos.s          fmod.s         log.s          setinternal.s
  643. TODO           cosh.s         fpumath.h      log10.s        sin.s
  644. _getsw.s       d2dcomb.summ   gamma.c        log1p.s        sinh.s
  645. acos.s         drem.s         hypot.s        log2.s         sqrt.s
  646. acosh.s        erf.c          ieee_ext.s     logb.s         sqrtp.s
  647. asin.s         exp.s          ieee_retro.c   mathimpl.h     tan.s
  648. asinh.s        exp10.s        ieee_values.s  nextafter.c    tanh.s
  649. X
  650. Comments
  651. --------
  652. The additional program paranoia.c attempts to tell how well your floating
  653. point conforms to the IEEE standard. You may like to compare the output
  654. when linked with your existing library and with this one. Paranoia cannot be
  655. compiled using standard 'cc' on Esix 3.2 revision D.
  656. X
  657. The file d2dcomb.summ contains a summary of some test results. See that
  658. file for details.
  659. X
  660. The IEEE specified functions with which you may not be familiar are:
  661. X
  662. double copysign(x,y)
  663. double x,y;
  664. copysign returns x with the sign of y. IEEE denormal will be set if x is a
  665. denormal.
  666. X
  667. double drem(x)
  668. double x;
  669. drem returns the IEEE remainder of x/y - it may be slow.
  670. X
  671. int finite(x)
  672. double x;
  673. finite returns true if -inf < x < inf; false otherwise. Does not raise any
  674. floating point exceptions.
  675. X
  676. double logb(x)
  677. double x;
  678. logb returns the unbiased exponent of its argument.
  679. X
  680. double rint(x)
  681. double x;
  682. rint returns its argument rounded in the prevailing rounding mode.
  683. X
  684. double scalb(x, n)
  685. double x;
  686. int n;
  687. scalb returns x*2^n.
  688. X
  689. Most of the above are just hooks directly into functions provided as single
  690. instructions in the 80387.
  691. X
  692. double infinity()
  693. infinity returns +inf. No exceptions are raised.
  694. X
  695. int isnan(x)
  696. double x;
  697. isnan returns 1 if x is a nan; 0 otherwise. Ieee exceptions are not
  698. affected.
  699. X
  700. int isnormal(x)
  701. double x;
  702. isnormal returns 1 if x is a normalized number; 0 otherwise. Ieee exceptions 
  703. are not affected.
  704. X
  705. int issubnormal(x)
  706. double x;
  707. issubnormal returns 1 if x is not a normalized number; 0 otherwise. Ieee 
  708. exceptions are not affected.
  709. X
  710. int iszero(x)
  711. double x;
  712. iszero returns 1 if x is +/- 0.0; 0 otherwise. Ieee exceptions are not affected.
  713. X
  714. int isinf(x)
  715. double x;
  716. isinf returns 1 if x is +/- inf; 0 otherwise. Ieee exceptions are not affected.
  717. X
  718. int signbit(x)
  719. double x;
  720. signbit return the sign of x. 1 if negative and 0 if positive. Ieee
  721. exceptions are not affected.
  722. X
  723. The is... functions and signbit are in the file ieee_ext.s
  724. X
  725. void ieee_retrospective(f)
  726. FILE *f;
  727. ieee_retrospective prints a list of IEEE exceptions that are currently
  728. active on the 80387 in the file pointed to by f.
  729. X
  730. double
  731. max_normal()
  732. max_normal returns the maximum +ve normalized number. No exceptions are
  733. raised.
  734. X
  735. double
  736. min_normal()
  737. mmin_normal returns the minimum +ve normalized number. No exceptions are
  738. raised.
  739. X
  740. double
  741. max_subnormal()
  742. max_subnormal returns the largest +ve denormalized number. This raises the
  743. denormal exception because of the way floating point numbers are returned.
  744. X
  745. double
  746. min_subnormal()
  747. min_subnormal returns the minimum +ve denormalized number. This raises the
  748. denormal exception because of the way floating point numbers are returned.
  749. X
  750. double
  751. quiet_nan(n)
  752. long n;
  753. quiet_nan returns a quiet nan. The argument is ignored. No exceptions are
  754. raised.
  755. X
  756. double
  757. signaling_nan(n)
  758. long n;
  759. signaling_nan returns a signaling nan. The argument is ignored. This raises
  760. the invalid operation exception because of the way floating point numbers
  761. are returned.
  762. X
  763. double
  764. nextafter(x,y)
  765. double x,y;
  766. nextafter returns the next representable floating point number from x in
  767. the direction of y. Exceptions may be raised depending on the arguments.
  768. X
  769. Additional Functions
  770. --------------------
  771. It is suggested in the book `Programming the 80386' by Crawford and Gelsinger
  772. that all floating point exceptions except `invalid operation' be masked. 
  773. That is the 80387's inbuilt exception handler should be used. If you want this 
  774. behaviour call setinternal() at the start of your code. This function is defined
  775. by:
  776. X
  777. int setinternal()
  778. X
  779. and is declared for your convenience in fpumath.h. The return value is the
  780. current control word. 
  781. X
  782. You can set the control word using setcont(mode). Again, this is defined in
  783. fpumath.h:
  784. X
  785. int setcont(mode)
  786. int mode;
  787. X
  788. This is really only provided to reset the original mode obtained using 
  789. setinternal(). The previous mode is returned.
  790. X
  791. Note that more general forms of these functions are provided in the standard 
  792. library using the fpsetmask and fpgetmask routines.
  793. X
  794. If you use setinternal(), arithmetic operations like 1/0 will return
  795. infinity - inf will be printed if you are printing the output. Note that 0/0 
  796. will still produce a floating point exception; the value of this operation 
  797. is undefined.
  798. X
  799. double sqrtp(x)
  800. double x;
  801. Returns the sqrt of x in 64 bit (double) mode irrespective of the current
  802. precision.
  803. X
  804. Acknowledgements
  805. ----------------
  806. I'd like to thank the developers of the Berkley Software Distribution who
  807. believe in software freedom and made my job easier by providing C source
  808. for all the functions. I also thank the author of paranoia.c. And also Dan Lau
  809. of Intel.
  810. ********************************************************************************
  811. ``This product includes software developed by the University of California,
  812. X Berkeley and its contributors''
  813. ********************************************************************************
  814. X
  815. I have decided to cover the parts I wrote by the GNU General Public Licence 
  816. with my modification (see below), a copy of which is included with this 
  817. distribution. Although the BSD and GNU licences are different I don't really 
  818. want people to split this distribution up. It's complete as it is.
  819. X
  820. In a nutshell, the Berkley code is covered by their licence. My code is covered
  821. by GNU's with my modification (see below). This infringes on nobodies rights.
  822. X
  823. Amendment to the GNU General Public Licence (*ONLY* applicable to my code)
  824. -------------------------------------------
  825. I may choose to cover this code by the Free Software Foundation's General
  826. Public Library Licence when it becomes available. At present I make the 
  827. following amendment to the licencing agreement:
  828. X
  829. *******************************************************************************
  830. You may use this library in products which are distributed in binary format
  831. only as long as you provide source code for the library with the distribution
  832. or will supply the source code for the library for a period of 3 years from the
  833. date of providing the binary files.
  834. ********************************************************************************
  835. X
  836. This in no way changes the GNU licence as applicable to other programs.
  837. X
  838. Installation
  839. ------------
  840. Edit the Makefile and change LIBDIR (default /lib) and INCDIR 
  841. (default /usr/include) according to taste.
  842. Type `make' to produce the library (libfpu.a) and paranoia.
  843. Type `make install' to install libfpu.a in $(LIBDIR) and fpumath.h 
  844. in $(INCDIR).
  845. X
  846. X
  847. X
  848. I'm interested in obtaining feedback on the performance of this library and
  849. of being informed of any bugs. I will continue to support this as long as I
  850. have a 32 bit Intel CPU running some form of UNIX and GNU C. My own
  851. development system was ESIX System V.3.2 revision D running on a 20 MHz
  852. 386 (and 387 of course!), gcc 1.37.1 and gas 1.36 with COFF/stab patches.
  853. X
  854. I have also modfied the f2c libF77 to use setcont() and ieee_retrospective()
  855. which makes the whole f2c environment on a 386 look like SUN FORTRAN. If
  856. anyone is interested in these (trivial) changes drop me a line.
  857. X
  858. Please mail comments and bug reports to glenn@qed.physics.su.oz.au.
  859. X
  860. X            Share and Enjoy,
  861. X                Glenn
  862. X
  863. You can also ftp this stuff from suphys.physics.su.oz.au.
  864. X
  865. Glenn Geers                       | "So when it's over, we're back to people.
  866. Department of Theoretical Physics |  Just to prove that human touch can have
  867. The University of Sydney          |  no equal."
  868. Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'
  869. X
  870. Ph: +61 2 692-3241
  871. SHAR_EOF
  872. chmod 0644 README ||
  873. echo 'restore of README failed'
  874. Wc_c="`wc -c < 'README'`"
  875. test 9579 -eq "$Wc_c" ||
  876.     echo 'README: original size 9579, current size' "$Wc_c"
  877. fi
  878. # ============= TODO ==============
  879. if test -f 'TODO' -a X"$1" != X"-c"; then
  880.     echo 'x - skipping TODO (File already exists)'
  881. else
  882. echo 'x - extracting TODO (Text)'
  883. sed 's/^X//' << 'SHAR_EOF' > 'TODO' &&
  884. 0. Keep modifying the sources to improve performance.
  885. 1. Modify the assembler source so that it works with the standard 'as'.
  886. 2. Add some more esoteric functions (suggestions?).
  887. 3. Write a float version.
  888. 4. Get rid of Berkley code if possible.
  889. SHAR_EOF
  890. chmod 0644 TODO ||
  891. echo 'restore of TODO failed'
  892. Wc_c="`wc -c < 'TODO'`"
  893. test 244 -eq "$Wc_c" ||
  894.     echo 'TODO: original size 244, current size' "$Wc_c"
  895. fi
  896. # ============= _getsw.s ==============
  897. if test -f '_getsw.s' -a X"$1" != X"-c"; then
  898.     echo 'x - skipping _getsw.s (File already exists)'
  899. else
  900. echo 'x - extracting _getsw.s (Text)'
  901. sed 's/^X//' << 'SHAR_EOF' > '_getsw.s' &&
  902. /*
  903. ** This file is part of the alternative 80386 math library and is
  904. ** covered by the GNU General Public license with my modification
  905. ** as noted in the README file that accompanied this file.
  906. **
  907. ** Copyright 1990 G. Geers
  908. **
  909. */
  910. X
  911. X        .align 4
  912. X        .globl _getsw
  913. X
  914. _getsw:
  915. X    pushl %ebp
  916. X    movl %esp,%ebp
  917. X
  918. X    fstsw %ax
  919. X
  920. X    leave
  921. X    ret
  922. SHAR_EOF
  923. chmod 0644 _getsw.s ||
  924. echo 'restore of _getsw.s failed'
  925. Wc_c="`wc -c < '_getsw.s'`"
  926. test 320 -eq "$Wc_c" ||
  927.     echo '_getsw.s: original size 320, current size' "$Wc_c"
  928. fi
  929. # ============= acos.s ==============
  930. if test -f 'acos.s' -a X"$1" != X"-c"; then
  931.     echo 'x - skipping acos.s (File already exists)'
  932. else
  933. echo 'x - extracting acos.s (Text)'
  934. sed 's/^X//' << 'SHAR_EOF' > 'acos.s' &&
  935. /*
  936. ** This file is part of the alternative 80386 math library and is
  937. ** covered by the GNU General Public license with my modification
  938. ** as noted in the README file that accompanied this file.
  939. **
  940. ** Copyright 1990 G. Geers
  941. **
  942. */
  943. X
  944. X    .align 4
  945. .Lhalfpi:
  946. X    .double 1.57079632679489661923
  947. X
  948. X    .align 4
  949. X    .globl acos
  950. acos:
  951. X    pushl %ebp
  952. X    movl %esp,%ebp
  953. X
  954. X    fldl 8(%ebp)
  955. X
  956. X    ftst
  957. X    fstsw %ax
  958. X    sahf
  959. X    jz .Lzero
  960. X
  961. X    fst %st(1)
  962. X    fmull 8(%ebp)
  963. X    fld1
  964. X    fsubp
  965. X    fsqrt
  966. X    fdivp
  967. X    fld1
  968. X    fpatan
  969. X    jnc .Ldone
  970. X
  971. X    fldpi
  972. X    faddp
  973. X    leave
  974. X    ret
  975. X
  976. .Lzero:
  977. X    fldl .Lhalfpi
  978. X
  979. .Ldone:
  980. X    leave
  981. X    ret
  982. SHAR_EOF
  983. chmod 0644 acos.s ||
  984. echo 'restore of acos.s failed'
  985. Wc_c="`wc -c < 'acos.s'`"
  986. test 544 -eq "$Wc_c" ||
  987.     echo 'acos.s: original size 544, current size' "$Wc_c"
  988. fi
  989. # ============= acosh.s ==============
  990. if test -f 'acosh.s' -a X"$1" != X"-c"; then
  991.     echo 'x - skipping acosh.s (File already exists)'
  992. else
  993. echo 'x - extracting acosh.s (Text)'
  994. sed 's/^X//' << 'SHAR_EOF' > 'acosh.s' &&
  995. /*
  996. ** This file is part of the alternative 80386 math library and is
  997. ** covered by the GNU General Public license with my modification
  998. ** as noted in the README file that accompanied this file.
  999. **
  1000. ** Copyright 1990 G. Geers
  1001. **
  1002. */
  1003. X
  1004. X    .align 4
  1005. X    .globl acosh
  1006. acosh:
  1007. X    pushl %ebp
  1008. X    movl %esp,%ebp
  1009. X
  1010. X    fldl 8(%ebp)
  1011. X
  1012. X    fmull 8(%ebp)
  1013. X    fld1
  1014. X    fsubrp
  1015. X    fsqrt
  1016. X    faddl 8(%ebp)
  1017. X    fldln2
  1018. X    fxch %st(1)
  1019. X    fyl2x
  1020. X
  1021. X    leave
  1022. X    ret
  1023. SHAR_EOF
  1024. chmod 0644 acosh.s ||
  1025. echo 'restore of acosh.s failed'
  1026. Wc_c="`wc -c < 'acosh.s'`"
  1027. test 398 -eq "$Wc_c" ||
  1028.     echo 'acosh.s: original size 398, current size' "$Wc_c"
  1029. fi
  1030. # ============= asin.s ==============
  1031. if test -f 'asin.s' -a X"$1" != X"-c"; then
  1032.     echo 'x - skipping asin.s (File already exists)'
  1033. else
  1034. echo 'x - extracting asin.s (Text)'
  1035. sed 's/^X//' << 'SHAR_EOF' > 'asin.s' &&
  1036. /*
  1037. ** This file is part of the alternative 80386 math library and is
  1038. ** covered by the GNU General Public license with my modification
  1039. ** as noted in the README file that accompanied this file.
  1040. **
  1041. ** Copyright 1990 G. Geers
  1042. **
  1043. */
  1044. X
  1045. X    .align 4
  1046. X    .globl asin
  1047. asin:
  1048. X    pushl %ebp
  1049. X    movl %esp,%ebp
  1050. X
  1051. X    fldl 8(%ebp)
  1052. X    fst %st(1)
  1053. X    fst %st(2)
  1054. X    fmulp
  1055. X    fld1
  1056. X    fsubp
  1057. X    fsqrt
  1058. X    fld1
  1059. X    fdivp
  1060. X    fmulp
  1061. X    fld1
  1062. X    fpatan
  1063. X
  1064. X    leave
  1065. X    ret
  1066. SHAR_EOF
  1067. chmod 0644 asin.s ||
  1068. echo 'restore of asin.s failed'
  1069. Wc_c="`wc -c < 'asin.s'`"
  1070. test 401 -eq "$Wc_c" ||
  1071.     echo 'asin.s: original size 401, current size' "$Wc_c"
  1072. fi
  1073. # ============= asinh.s ==============
  1074. if test -f 'asinh.s' -a X"$1" != X"-c"; then
  1075.     echo 'x - skipping asinh.s (File already exists)'
  1076. else
  1077. echo 'x - extracting asinh.s (Text)'
  1078. sed 's/^X//' << 'SHAR_EOF' > 'asinh.s' &&
  1079. /*
  1080. ** This file is part of the alternative 80386 math library and is
  1081. ** covered by the GNU General Public license with my modification
  1082. ** as noted in the README file that accompanied this file.
  1083. **
  1084. ** Copyright 1990 G. Geers
  1085. **
  1086. */
  1087. X
  1088. X    .align 4
  1089. X    .globl asinh
  1090. asinh:
  1091. X    pushl %ebp
  1092. X    movl %esp,%ebp
  1093. X
  1094. X    fldl 8(%ebp)
  1095. X
  1096. X    fmull 8(%ebp)
  1097. X    fld1
  1098. X    faddp
  1099. X    fsqrt
  1100. X    faddl 8(%ebp)
  1101. X    fldln2
  1102. X    fxch %st(1)
  1103. X    fyl2x
  1104. X
  1105. X    leave
  1106. X    ret
  1107. SHAR_EOF
  1108. chmod 0644 asinh.s ||
  1109. echo 'restore of asinh.s failed'
  1110. Wc_c="`wc -c < 'asinh.s'`"
  1111. test 397 -eq "$Wc_c" ||
  1112.     echo 'asinh.s: original size 397, current size' "$Wc_c"
  1113. fi
  1114. # ============= atan.s ==============
  1115. if test -f 'atan.s' -a X"$1" != X"-c"; then
  1116.     echo 'x - skipping atan.s (File already exists)'
  1117. else
  1118. echo 'x - extracting atan.s (Text)'
  1119. sed 's/^X//' << 'SHAR_EOF' > 'atan.s' &&
  1120. /*
  1121. ** This file is part of the alternative 80386 math library and is
  1122. ** covered by the GNU General Public license with my modification
  1123. ** as noted in the README file that accompanied this file.
  1124. **
  1125. ** Copyright 1990 G. Geers
  1126. **
  1127. */
  1128. X
  1129. X    .align 4
  1130. X    .globl atan
  1131. atan:
  1132. X    pushl %ebp
  1133. X    movl %esp,%ebp
  1134. X    
  1135. X    fldl 8(%ebp)
  1136. X    fld1
  1137. X    fpatan
  1138. X
  1139. X    leave
  1140. X    ret
  1141. SHAR_EOF
  1142. chmod 0644 atan.s ||
  1143. echo 'restore of atan.s failed'
  1144. Wc_c="`wc -c < 'atan.s'`"
  1145. test 331 -eq "$Wc_c" ||
  1146.     echo 'atan.s: original size 331, current size' "$Wc_c"
  1147. fi
  1148. # ============= atan2.s ==============
  1149. if test -f 'atan2.s' -a X"$1" != X"-c"; then
  1150.     echo 'x - skipping atan2.s (File already exists)'
  1151. else
  1152. echo 'x - extracting atan2.s (Text)'
  1153. sed 's/^X//' << 'SHAR_EOF' > 'atan2.s' &&
  1154. /*
  1155. ** This file is part of the alternative 80386 math library and is
  1156. ** covered by the GNU General Public license with my modification
  1157. ** as noted in the README file that accompanied this file.
  1158. **
  1159. ** Copyright 1990 G. Geers
  1160. **
  1161. */
  1162. X
  1163. X    .align 4
  1164. .Lpi:
  1165. X    .double 3.14159265358979323846
  1166. X
  1167. X    .align 4
  1168. .Lmpi:
  1169. X    .double -3.14159265358979323846
  1170. X
  1171. X    .align 4
  1172. .Lhalfpi: 
  1173. X    .double 1.57079632679489661923
  1174. X
  1175. X    .align 4
  1176. .Lmhalfpi:
  1177. X    .double -1.57079632679489661923
  1178. X
  1179. X    .align 4
  1180. X    .globl atan2
  1181. atan2:
  1182. X    pushl %ebp
  1183. X    movl %esp,%ebp
  1184. X
  1185. X    fldl 16(%ebp)
  1186. X    ftst
  1187. X    fnstsw %ax
  1188. X    sahf 
  1189. X    fldl 8(%ebp)
  1190. X    jz .Lgotzero
  1191. X    jc .Lgotneg
  1192. X
  1193. X    fdivp
  1194. X    fld1
  1195. X    fpatan
  1196. X
  1197. X    leave
  1198. X    ret
  1199. X
  1200. .Lgotneg:
  1201. X    ftst
  1202. X    fnstsw %ax
  1203. X    sahf 
  1204. X    jc .Lneg1
  1205. X
  1206. X    fdivp
  1207. X    fld1
  1208. X    fpatan
  1209. X    fldl .Lmpi
  1210. X    fsubrp
  1211. X
  1212. X    leave
  1213. X    ret
  1214. X
  1215. .Lneg1:
  1216. X    fdivp
  1217. X    fld1
  1218. X    fpatan
  1219. X    fldl .Lpi
  1220. X    fsubrp
  1221. X
  1222. X    leave
  1223. X    ret
  1224. X
  1225. .Lgotzero:
  1226. X    ftst
  1227. X    fnstsw %ax
  1228. X    sahf
  1229. X    jz .Lzero
  1230. X    jc .Lneg
  1231. X
  1232. X    fldl .Lhalfpi
  1233. X
  1234. X    leave
  1235. X    ret
  1236. X
  1237. .Lzero:
  1238. X    fldz
  1239. X
  1240. X    leave
  1241. X    ret
  1242. X
  1243. .Lneg:
  1244. X    fldl .Lmhalfpi
  1245. X
  1246. X    leave
  1247. X    ret
  1248. SHAR_EOF
  1249. chmod 0644 atan2.s ||
  1250. echo 'restore of atan2.s failed'
  1251. Wc_c="`wc -c < 'atan2.s'`"
  1252. test 931 -eq "$Wc_c" ||
  1253.     echo 'atan2.s: original size 931, current size' "$Wc_c"
  1254. fi
  1255. # ============= atanh.s ==============
  1256. if test -f 'atanh.s' -a X"$1" != X"-c"; then
  1257.     echo 'x - skipping atanh.s (File already exists)'
  1258. else
  1259. echo 'x - extracting atanh.s (Text)'
  1260. sed 's/^X//' << 'SHAR_EOF' > 'atanh.s' &&
  1261. /*
  1262. ** This file is part of the alternative 80386 math library and is
  1263. ** covered by the GNU General Public license with my modification
  1264. ** as noted in the README file that accompanied this file.
  1265. **
  1266. ** Copyright 1990 G. Geers
  1267. **
  1268. */
  1269. X
  1270. X    .align 4
  1271. .Lhalf:
  1272. X    .double 0.500
  1273. X
  1274. X    .align 4
  1275. X    .globl atanh
  1276. atanh:
  1277. X    pushl %ebp
  1278. X    movl %esp,%ebp
  1279. X
  1280. X    fld1
  1281. X    faddl 8(%ebp)
  1282. X    fld1
  1283. X    fsubl 8(%ebp)
  1284. X    fdivrp
  1285. X
  1286. X    fldln2
  1287. X    fxch %st(1)
  1288. X    fyl2x
  1289. X
  1290. X    fldl .Lhalf
  1291. X    fmulp
  1292. X
  1293. X    leave
  1294. X    ret
  1295. SHAR_EOF
  1296. chmod 0644 atanh.s ||
  1297. echo 'restore of atanh.s failed'
  1298. Wc_c="`wc -c < 'atanh.s'`"
  1299. test 438 -eq "$Wc_c" ||
  1300.     echo 'atanh.s: original size 438, current size' "$Wc_c"
  1301. fi
  1302. # ============= ceil.s ==============
  1303. if test -f 'ceil.s' -a X"$1" != X"-c"; then
  1304.     echo 'x - skipping ceil.s (File already exists)'
  1305. else
  1306. echo 'x - extracting ceil.s (Text)'
  1307. sed 's/^X//' << 'SHAR_EOF' > 'ceil.s' &&
  1308. /*
  1309. ** This file is part of the alternative 80386 math library and is
  1310. ** covered by the GNU General Public license with my modification
  1311. ** as noted in the README file that accompanied this file.
  1312. **
  1313. ** Could use ceil(x) = -floor(-x) but this is quicker.
  1314. **
  1315. ** Copyright 1990 G. Geers
  1316. **
  1317. */
  1318. X
  1319. X    .align 4
  1320. X    .globl ceil
  1321. ceil:
  1322. X    pushl %ebp
  1323. X    movl %esp,%ebp
  1324. X    subl $8, %esp
  1325. X    
  1326. X    fldl 8(%ebp)        /* load data */
  1327. X
  1328. X    fstcw -12(%ebp)        /* store control word */
  1329. X    fstcw -16(%ebp)        /* store it again */
  1330. X    orw $0x0800, -16(%ebp)    /* round toward +inf */
  1331. X    fldcw -16(%ebp)        /* store new control word */
  1332. X    frndint            /* rounding gives ceil(x) */
  1333. X    fldcw -12(%ebp)        /* restore original control word */
  1334. X
  1335. X    leave
  1336. X    ret
  1337. SHAR_EOF
  1338. chmod 0644 ceil.s ||
  1339. echo 'restore of ceil.s failed'
  1340. Wc_c="`wc -c < 'ceil.s'`"
  1341. test 682 -eq "$Wc_c" ||
  1342.     echo 'ceil.s: original size 682, current size' "$Wc_c"
  1343. fi
  1344. # ============= copysign.s ==============
  1345. if test -f 'copysign.s' -a X"$1" != X"-c"; then
  1346.     echo 'x - skipping copysign.s (File already exists)'
  1347. else
  1348. echo 'x - extracting copysign.s (Text)'
  1349. sed 's/^X//' << 'SHAR_EOF' > 'copysign.s' &&
  1350. /*
  1351. ** This file is part of the alternative 80386 math library and is
  1352. ** covered by the GNU General Public license with my modification
  1353. ** as noted in the README file that accompanied this file.
  1354. **
  1355. ** Copyright 1990 G. Geers
  1356. **
  1357. */
  1358. X
  1359. X    .align 4
  1360. .globl copysign
  1361. copysign:
  1362. X    pushl %ebp
  1363. X    movl %esp,%ebp
  1364. X
  1365. X    movl 20(%ebp), %eax
  1366. X    andl $0x80000000, %eax
  1367. X    cmpl $0x80000000, %eax
  1368. X    je .Lneg
  1369. X    andl $0x7fffffff, 12(%ebp)
  1370. X    fldl 8(%ebp)        /* Store argument for return */
  1371. X    leave
  1372. X    ret
  1373. .Lneg:
  1374. X    orl $0x80000000, 12(%ebp)
  1375. X    fldl 8(%ebp)        /* Store argument for return */
  1376. X    leave
  1377. X    ret
  1378. SHAR_EOF
  1379. chmod 0644 copysign.s ||
  1380. echo 'restore of copysign.s failed'
  1381. Wc_c="`wc -c < 'copysign.s'`"
  1382. test 555 -eq "$Wc_c" ||
  1383.     echo 'copysign.s: original size 555, current size' "$Wc_c"
  1384. fi
  1385. # ============= cos.s ==============
  1386. if test -f 'cos.s' -a X"$1" != X"-c"; then
  1387.     echo 'x - skipping cos.s (File already exists)'
  1388. else
  1389. echo 'x - extracting cos.s (Text)'
  1390. sed 's/^X//' << 'SHAR_EOF' > 'cos.s' &&
  1391. /*
  1392. ** This file is part of the alternative 80386 math library and is
  1393. ** covered by the GNU General Public license with my modification
  1394. ** as noted in the README file that accompanied this file.
  1395. **
  1396. ** Copyright 1990 G. Geers
  1397. **
  1398. */
  1399. X
  1400. X    .align 4
  1401. X    .globl cos
  1402. cos:
  1403. X    pushl %ebp
  1404. X    movl %esp,%ebp
  1405. X
  1406. X    fldl 8(%ebp)
  1407. X    fcos
  1408. X
  1409. X    leave
  1410. X    ret
  1411. SHAR_EOF
  1412. chmod 0644 cos.s ||
  1413. echo 'restore of cos.s failed'
  1414. Wc_c="`wc -c < 'cos.s'`"
  1415. test 320 -eq "$Wc_c" ||
  1416.     echo 'cos.s: original size 320, current size' "$Wc_c"
  1417. fi
  1418. # ============= cosh.s ==============
  1419. if test -f 'cosh.s' -a X"$1" != X"-c"; then
  1420.     echo 'x - skipping cosh.s (File already exists)'
  1421. else
  1422. echo 'x - extracting cosh.s (Text)'
  1423. sed 's/^X//' << 'SHAR_EOF' > 'cosh.s' &&
  1424. /*
  1425. ** This file is part of the alternative 80386 math library and is
  1426. ** covered by the GNU General Public license with my modification
  1427. ** as noted in the README file that accompanied this file.
  1428. **
  1429. ** Copyright 1990 G. Geers
  1430. **
  1431. */
  1432. X
  1433. X    .align 4
  1434. .LC2:
  1435. X    .double 0.500
  1436. X
  1437. X    .align 4
  1438. X    .globl cosh
  1439. cosh:
  1440. X    pushl %ebp
  1441. X    movl %esp,%ebp
  1442. X
  1443. X    fldl 8(%ebp)
  1444. X    fldl2e
  1445. X    fmulp
  1446. X    fstl %st(1)
  1447. X    frndint
  1448. X    fstl %st(2)
  1449. X    fsubrp
  1450. X    f2xm1
  1451. X    fld1
  1452. X    faddp
  1453. X    fscale
  1454. X    fst %st(1)
  1455. X
  1456. X    fld1
  1457. X    fdivp
  1458. X    faddp
  1459. X
  1460. X    fldl .LC2
  1461. X    fmulp
  1462. X
  1463. X    leave
  1464. X    ret
  1465. SHAR_EOF
  1466. chmod 0644 cosh.s ||
  1467. echo 'restore of cosh.s failed'
  1468. Wc_c="`wc -c < 'cosh.s'`"
  1469. test 486 -eq "$Wc_c" ||
  1470.     echo 'cosh.s: original size 486, current size' "$Wc_c"
  1471. fi
  1472. # ============= d2dcomb.summ ==============
  1473. if test -f 'd2dcomb.summ' -a X"$1" != X"-c"; then
  1474.     echo 'x - skipping d2dcomb.summ (File already exists)'
  1475. else
  1476. echo 'x - extracting d2dcomb.summ (Text)'
  1477. sed 's/^X//' << 'SHAR_EOF' > 'd2dcomb.summ' &&
  1478. Comments
  1479. --------
  1480. These tests were done using routines distributed with the Portable Math 
  1481. Library by Fred Fish. I have a sneaking feeling that his exp, atanh and 
  1482. atan return bad results (double precision FORTRAN library under TOPS-20) 
  1483. since the '387 and SUN 4 results agree. I have partially verified this 
  1484. using the extended tables in Abramowitz & Stegun.
  1485. X
  1486. Results from libfpu.a
  1487. dabs:    maximum relative error 0.000000e+00
  1488. acos:    maximum relative error 1.395807e-16
  1489. acosh:    maximum relative error 1.686042e-16
  1490. asin:    maximum relative error 1.378420e-16
  1491. asinh:    maximum relative error 1.181272e-13
  1492. atan:    maximum relative error 6.406394e-12
  1493. atan2:    maximum relative error 2.261728e-15
  1494. atanh:    maximum relative error 3.731406e-13
  1495. cos:    maximum relative error 0.000000e+00
  1496. cosh:    maximum relative error 3.828768e-15
  1497. exp:    maximum relative error 4.165239e-13
  1498. log:    maximum relative error 0.000000e+00
  1499. log10:    maximum relative error 0.000000e+00
  1500. sin:    maximum relative error 1.855096e-16
  1501. sinh:    maximum relative error 3.828768e-15
  1502. sqrt:    maximum relative error 1.252752e-16
  1503. tan:    maximum relative error 1.110223e-16
  1504. tanh:    maximum relative error 1.201235e-16
  1505. X
  1506. Results from libfpu.a with extended precision
  1507. dabs:    maximum relative error 0.000000e+00
  1508. acos:    maximum relative error 1.892807e-16
  1509. acosh:    maximum relative error 0.000000e+00
  1510. asin:    maximum relative error 1.431811e-16
  1511. asinh:    maximum relative error 7.000127e-16
  1512. atan:    maximum relative error 6.406394e-12
  1513. atan2:    maximum relative error 2.261728e-15
  1514. atanh:    maximum relative error 3.731406e-13
  1515. cos:    maximum relative error 0.000000e+00
  1516. cosh:    maximum relative error 0.000000e+00
  1517. exp:    maximum relative error 4.176205e-13
  1518. log:    maximum relative error 0.000000e+00
  1519. log10:    maximum relative error 0.000000e+00
  1520. sin:    maximum relative error 1.855096e-16
  1521. sinh:    maximum relative error 0.000000e+00
  1522. sqrt:    maximum relative error 1.252752e-16
  1523. tan:    maximum relative error 1.110223e-16
  1524. tanh:    maximum relative error 1.226565e-16
  1525. X
  1526. Results form libm.a (Esix standard) - deleted functions do not exist
  1527. dabs:    maximum relative error 0.000000e+00
  1528. acos:    maximum relative error 1.892807e-16
  1529. asin:    maximum relative error 1.431811e-16
  1530. atan:    maximum relative error 6.406394e-12
  1531. atan2:    maximum relative error 2.261728e-15
  1532. cos:    maximum relative error 0.000000e+00
  1533. cosh:    maximum relative error 3.828768e-15
  1534. exp:    maximum relative error 4.165239e-13
  1535. log:    maximum relative error 0.000000e+00
  1536. log10:    maximum relative error 0.000000e+00
  1537. sin:    maximum relative error 1.855096e-16
  1538. sinh:    maximum relative error 3.828768e-15
  1539. sqrt:    maximum relative error 1.252752e-16
  1540. tan:    maximum relative error 1.110223e-16
  1541. tanh:    maximum relative error 1.201235e-16
  1542. X
  1543. Results form libm.a (SUN 4)
  1544. dabs:    maximum relative error 0.000000e+00
  1545. acos:    maximum relative error 0.000000e+00
  1546. acosh:    maximum relative error 1.686042e-16
  1547. asin:    maximum relative error 1.378420e-16
  1548. asinh:    maximum relative error 7.000127e-16
  1549. atan:    maximum relative error 6.406394e-12
  1550. atan2:    maximum relative error 2.261728e-15
  1551. atanh:    maximum relative error 3.731406e-13
  1552. cos:    maximum relative error 1.156277e-16
  1553. cosh:    maximum relative error 1.651640e-16
  1554. exp:    maximum relative error 4.176205e-13
  1555. log:    maximum relative error 0.000000e+00
  1556. log10:    maximum relative error 0.000000e+00
  1557. sin:    maximum relative error 1.855096e-16
  1558. sinh:    maximum relative error 0.000000e+00
  1559. sqrt:    maximum relative error 1.252753e-16
  1560. tan:    maximum relative error 1.425732e-16
  1561. tanh:    maximum relative error 0.000000e+00
  1562. SHAR_EOF
  1563. chmod 0644 d2dcomb.summ ||
  1564. echo 'restore of d2dcomb.summ failed'
  1565. Wc_c="`wc -c < 'd2dcomb.summ'`"
  1566. test 3424 -eq "$Wc_c" ||
  1567.     echo 'd2dcomb.summ: original size 3424, current size' "$Wc_c"
  1568. fi
  1569. # ============= drem.s ==============
  1570. if test -f 'drem.s' -a X"$1" != X"-c"; then
  1571.     echo 'x - skipping drem.s (File already exists)'
  1572. else
  1573. echo 'x - extracting drem.s (Text)'
  1574. sed 's/^X//' << 'SHAR_EOF' > 'drem.s' &&
  1575. /*
  1576. ** This file is part of the alternative 80386 math library and is
  1577. ** covered by the GNU General Public license with my modification
  1578. ** as noted in the README file that accompanied this file.
  1579. **
  1580. ** Copyright 1990 G. Geers
  1581. **
  1582. */
  1583. X
  1584. X    .align 4
  1585. X    .globl drem
  1586. drem:
  1587. X    pushl %ebp
  1588. X    movl %esp,%ebp
  1589. X    
  1590. X    fldl 16(%ebp)
  1591. X    fldl 8(%ebp)
  1592. .Lnotred:
  1593. X    fprem1
  1594. X
  1595. X    fstsw %ax
  1596. X    sahf
  1597. X    jp .Lnotred
  1598. X
  1599. X    leave
  1600. X    ret
  1601. SHAR_EOF
  1602. chmod 0644 drem.s ||
  1603. echo 'restore of drem.s failed'
  1604. Wc_c="`wc -c < 'drem.s'`"
  1605. test 381 -eq "$Wc_c" ||
  1606.     echo 'drem.s: original size 381, current size' "$Wc_c"
  1607. fi
  1608. # ============= erf.c ==============
  1609. if test -f 'erf.c' -a X"$1" != X"-c"; then
  1610.     echo 'x - skipping erf.c (File already exists)'
  1611. else
  1612. echo 'x - extracting erf.c (Text)'
  1613. sed 's/^X//' << 'SHAR_EOF' > 'erf.c' &&
  1614. /*
  1615. X * Copyright (c) 1985 Regents of the University of California.
  1616. X * All rights reserved.  The Berkeley software License Agreement
  1617. X * specifies the terms and conditions for redistribution.
  1618. X */
  1619. X
  1620. #ifndef lint
  1621. static char sccsid[] = "@(#)erf.c    5.2 (Berkeley) 4/29/88";
  1622. #endif /* not lint */
  1623. X
  1624. /*
  1625. X    C program for floating point error function
  1626. X
  1627. X    erf(x) returns the error function of its argument
  1628. X    erfc(x) returns 1.0-erf(x)
  1629. X
  1630. X    erf(x) is defined by
  1631. X    ${2 over sqrt(pi)} int from 0 to x e sup {-t sup 2} dt$
  1632. X
  1633. X    the entry for erfc is provided because of the
  1634. X    extreme loss of relative accuracy if erf(x) is
  1635. X    called for large x and the result subtracted
  1636. X    from 1. (e.g. for x= 10, 12 places are lost).
  1637. X
  1638. X    There are no error returns.
  1639. X
  1640. X    Calls exp.
  1641. X
  1642. X    Coefficients for large x are #5667 from Hart & Cheney (18.72D).
  1643. */
  1644. X
  1645. #define M 7
  1646. #define N 9
  1647. X
  1648. extern double sqrt();
  1649. extern double exp();
  1650. X
  1651. static double torp = 1.1283791670955125738961589031;
  1652. static double p1[] = {
  1653. X    0.804373630960840172832162e5,
  1654. X    0.740407142710151470082064e4,
  1655. X    0.301782788536507577809226e4,
  1656. X    0.380140318123903008244444e2,
  1657. X    0.143383842191748205576712e2,
  1658. X    -.288805137207594084924010e0,
  1659. X    0.007547728033418631287834e0,
  1660. };
  1661. static double q1[]  = {
  1662. X    0.804373630960840172826266e5,
  1663. X    0.342165257924628539769006e5,
  1664. X    0.637960017324428279487120e4,
  1665. X    0.658070155459240506326937e3,
  1666. X    0.380190713951939403753468e2,
  1667. X    0.100000000000000000000000e1,
  1668. X    0.0,
  1669. };
  1670. static double p2[]  = {
  1671. X    0.18263348842295112592168999e4,
  1672. X    0.28980293292167655611275846e4,
  1673. X    0.2320439590251635247384768711e4,
  1674. X    0.1143262070703886173606073338e4,
  1675. X    0.3685196154710010637133875746e3,
  1676. X    0.7708161730368428609781633646e2,
  1677. X    0.9675807882987265400604202961e1,
  1678. X    0.5641877825507397413087057563e0,
  1679. X    0.0,
  1680. };
  1681. static double q2[]  = {
  1682. X    0.18263348842295112595576438e4,
  1683. X    0.495882756472114071495438422e4,
  1684. X    0.60895424232724435504633068e4,
  1685. X    0.4429612803883682726711528526e4,
  1686. X    0.2094384367789539593790281779e4,
  1687. X    0.6617361207107653469211984771e3,
  1688. X    0.1371255960500622202878443578e3,
  1689. X    0.1714980943627607849376131193e2,
  1690. X    1.0,
  1691. };
  1692. X
  1693. double
  1694. erf(arg) double arg;{
  1695. X    double erfc();
  1696. X    int sign;
  1697. X    double argsq;
  1698. X    double d, n;
  1699. X    int i;
  1700. X
  1701. X    sign = 1;
  1702. X    if(arg < 0.){
  1703. X        arg = -arg;
  1704. X        sign = -1;
  1705. X    }
  1706. X    if(arg < 0.5){
  1707. X        argsq = arg*arg;
  1708. X        for(n=0,d=0,i=M-1; i>=0; i--){
  1709. X            n = n*argsq + p1[i];
  1710. X            d = d*argsq + q1[i];
  1711. X        }
  1712. X        return(sign*torp*arg*n/d);
  1713. X    }
  1714. X    if(arg >= 10.)
  1715. X        return(sign*1.);
  1716. X    return(sign*(1. - erfc(arg)));
  1717. }
  1718. X
  1719. double
  1720. erfc(arg) double arg;{
  1721. X    double erf();
  1722. X    double exp();
  1723. X    double n, d;
  1724. X    int i;
  1725. X
  1726. X    if(arg < 0.)
  1727. X        return(2. - erfc(-arg));
  1728. /*
  1729. X    if(arg < 0.5)
  1730. X        return(1. - erf(arg));
  1731. */
  1732. X    if(arg >= 10.)
  1733. X        return(0.);
  1734. X
  1735. X    for(n=0,d=0,i=N-1; i>=0; i--){
  1736. X        n = n*arg + p2[i];
  1737. X        d = d*arg + q2[i];
  1738. X    }
  1739. X    return(exp(-arg*arg)*n/d);
  1740. }
  1741. SHAR_EOF
  1742. chmod 0644 erf.c ||
  1743. echo 'restore of erf.c failed'
  1744. Wc_c="`wc -c < 'erf.c'`"
  1745. test 2681 -eq "$Wc_c" ||
  1746.     echo 'erf.c: original size 2681, current size' "$Wc_c"
  1747. fi
  1748. # ============= exp.s ==============
  1749. if test -f 'exp.s' -a X"$1" != X"-c"; then
  1750.     echo 'x - skipping exp.s (File already exists)'
  1751. else
  1752. echo 'x - extracting exp.s (Text)'
  1753. sed 's/^X//' << 'SHAR_EOF' > 'exp.s' &&
  1754. /*
  1755. ** This file is part of the alternative 80386 math library and is
  1756. ** covered by the GNU General Public license with my modification
  1757. ** as noted in the README file that accompanied this file.
  1758. **
  1759. ** Copyright 1990 G. Geers
  1760. **
  1761. */
  1762. X
  1763. X    .align 4
  1764. X    .globl exp
  1765. exp:
  1766. X    pushl %ebp
  1767. X    movl %esp,%ebp
  1768. X
  1769. X    fldl 8(%ebp)
  1770. X    fldl2e
  1771. X    fmulp
  1772. X    fstl %st(1)
  1773. X    frndint
  1774. X    fstl %st(2)
  1775. X    fsubrp
  1776. X    f2xm1
  1777. X    fld1
  1778. X    faddp
  1779. X    fscale
  1780. X
  1781. X    leave
  1782. X    ret
  1783. SHAR_EOF
  1784. chmod 0644 exp.s ||
  1785. echo 'restore of exp.s failed'
  1786. Wc_c="`wc -c < 'exp.s'`"
  1787. test 400 -eq "$Wc_c" ||
  1788.     echo 'exp.s: original size 400, current size' "$Wc_c"
  1789. fi
  1790. # ============= exp10.s ==============
  1791. if test -f 'exp10.s' -a X"$1" != X"-c"; then
  1792.     echo 'x - skipping exp10.s (File already exists)'
  1793. else
  1794. echo 'x - extracting exp10.s (Text)'
  1795. sed 's/^X//' << 'SHAR_EOF' > 'exp10.s' &&
  1796. /*
  1797. ** This file is part of the alternative 80386 math library and is
  1798. ** covered by the GNU General Public license with my modification
  1799. ** as noted in the README file that accompanied this file.
  1800. **
  1801. ** Copyright 1990 G. Geers
  1802. **
  1803. */
  1804. X
  1805. X    .align 4
  1806. X    .globl exp10
  1807. exp10:
  1808. X    pushl %ebp
  1809. X    movl %esp,%ebp
  1810. X
  1811. X    fldl 8(%ebp)
  1812. X    fldl2t
  1813. X    fmulp
  1814. X    fstl %st(1)
  1815. X    frndint
  1816. X    fstl %st(2)
  1817. X    fsubrp
  1818. X    f2xm1
  1819. X    fld1
  1820. X    faddp
  1821. X    fscale
  1822. X
  1823. X    leave
  1824. X    ret
  1825. SHAR_EOF
  1826. chmod 0644 exp10.s ||
  1827. echo 'restore of exp10.s failed'
  1828. Wc_c="`wc -c < 'exp10.s'`"
  1829. test 404 -eq "$Wc_c" ||
  1830.     echo 'exp10.s: original size 404, current size' "$Wc_c"
  1831. fi
  1832. # ============= exp2.s ==============
  1833. if test -f 'exp2.s' -a X"$1" != X"-c"; then
  1834.     echo 'x - skipping exp2.s (File already exists)'
  1835. else
  1836. echo 'x - extracting exp2.s (Text)'
  1837. sed 's/^X//' << 'SHAR_EOF' > 'exp2.s' &&
  1838. /*
  1839. ** This file is part of the alternative 80386 math library and is
  1840. ** covered by the GNU General Public license with my modification
  1841. ** as noted in the README file that accompanied this file.
  1842. **
  1843. ** Copyright 1990 G. Geers
  1844. **
  1845. */
  1846. X
  1847. X    .align 4
  1848. X    .globl exp2
  1849. exp2:
  1850. X    pushl %ebp
  1851. X    movl %esp,%ebp
  1852. X
  1853. X    fldl 8(%ebp)
  1854. X    fstl %st(1)
  1855. X    frndint
  1856. X    fstl %st(2)
  1857. X    fsubrp
  1858. X    f2xm1
  1859. X    fld1
  1860. X    faddp
  1861. X    fscale
  1862. X
  1863. X    leave
  1864. X    ret
  1865. SHAR_EOF
  1866. chmod 0644 exp2.s ||
  1867. echo 'restore of exp2.s failed'
  1868. Wc_c="`wc -c < 'exp2.s'`"
  1869. test 387 -eq "$Wc_c" ||
  1870.     echo 'exp2.s: original size 387, current size' "$Wc_c"
  1871. fi
  1872. # ============= expm1.s ==============
  1873. if test -f 'expm1.s' -a X"$1" != X"-c"; then
  1874.     echo 'x - skipping expm1.s (File already exists)'
  1875. else
  1876. echo 'x - extracting expm1.s (Text)'
  1877. sed 's/^X//' << 'SHAR_EOF' > 'expm1.s' &&
  1878. /*
  1879. ** This file is part of the alternative 80386 math library and is
  1880. ** covered by the GNU General Public license with my modification
  1881. ** as noted in the README file that accompanied this file.
  1882. **
  1883. ** Copyright 1990 G. Geers
  1884. **
  1885. */
  1886. X
  1887. X    .align 4
  1888. X    .globl expm1
  1889. expm1:
  1890. X    pushl %ebp
  1891. X    movl %esp,%ebp
  1892. X
  1893. X    fldl 8(%ebp)
  1894. X    fldl2e
  1895. X    fmulp
  1896. X    fstl %st(1)
  1897. X    frndint
  1898. X    fstl %st(2)
  1899. X    fsubrp
  1900. X    f2xm1
  1901. X    fld1
  1902. X    faddp
  1903. X    fscale
  1904. X    fld1
  1905. X    fsubrp
  1906. X
  1907. X    leave
  1908. X    ret
  1909. SHAR_EOF
  1910. chmod 0644 expm1.s ||
  1911. echo 'restore of expm1.s failed'
  1912. Wc_c="`wc -c < 'expm1.s'`"
  1913. test 418 -eq "$Wc_c" ||
  1914.     echo 'expm1.s: original size 418, current size' "$Wc_c"
  1915. fi
  1916. true || echo 'restore of fabs.s failed'
  1917. echo End of part 1, continue with part 2
  1918. exit 0
  1919. --
  1920. Glenn Geers                       | "So when it's over, we're back to people.
  1921. Department of Theoretical Physics |  Just to prove that human touch can have
  1922. The University of Sydney          |  no equal."
  1923. Sydney NSW 2006 Australia         |  - Basia Trzetrzelewska, 'Prime Time TV'
  1924.