src/JavaMathSupport.st
author vranyj1
Wed, 07 Sep 2011 16:38:51 +0000
branchjk_new_structure
changeset 988 414a2c9a6a9e
parent 987 7ce13ad78d68
child 990 5e4818e67471
permissions -rw-r--r--
Java-style FP math natives and support methods
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
987
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     1
"
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     5
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     7
 license:
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     8
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    14
 hereby transferred.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    15
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    17
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    19
 obtaining a copy of this software and associated documentation
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    20
 files (the 'Software'), to deal in the Software without
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    21
 restriction, including without limitation the rights to use,
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    23
 copies of the Software, and to permit persons to whom the
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    24
 Software is furnished to do so, subject to the following
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    25
 conditions:
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    26
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    27
 The above copyright notice and this permission notice shall be
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    28
 included in all copies or substantial portions of the Software.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    29
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    38
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    40
     of one of the above copright owners.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    41
"
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    42
"{ Package: 'stx:libjava' }"
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    43
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    44
Object subclass:#JavaMathSupport
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    45
	instanceVariableNames:''
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    46
	classVariableNames:''
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    47
	poolDictionaries:''
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    48
	category:'Languages-Java-Support-Native'
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    49
!
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    50
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    51
!JavaMathSupport class methodsFor:'documentation'!
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    52
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    53
copyright
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    54
"
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    55
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    56
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    57
                            SWING Research Group, Czech Technical University in Prague
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    58
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    59
 Parts of the code written by Claus Gittinger are under following
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    60
 license:
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    61
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    62
 This software is furnished under a license and may be used
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    63
 only in accordance with the terms of that license and with the
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    64
 inclusion of the above copyright notice.   This software may not
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    65
 be provided or otherwise made available to, or used by, any
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    66
 other person.  No title to or ownership of the software is
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    67
 hereby transferred.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    68
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    69
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    70
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    71
 Permission is hereby granted, free of charge, to any person
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    72
 obtaining a copy of this software and associated documentation
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    73
 files (the 'Software'), to deal in the Software without
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    74
 restriction, including without limitation the rights to use,
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    75
 copy, modify, merge, publish, distribute, sublicense, and/or sell
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    76
 copies of the Software, and to permit persons to whom the
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    77
 Software is furnished to do so, subject to the following
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    78
 conditions:
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    79
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    80
 The above copyright notice and this permission notice shall be
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    81
 included in all copies or substantial portions of the Software.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    82
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    83
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    84
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    85
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    86
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    87
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    88
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    89
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    90
 OTHER DEALINGS IN THE SOFTWARE.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    91
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    92
 [1] Code written at SWING Research Group contain a signature
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    93
     of one of the above copright owners.
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    94
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    95
"
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    96
! !
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    97
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    98
!JavaMathSupport class methodsFor:'java-style FP functions'!
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
    99
988
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   100
cos:arg
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   101
    self shouldImplement
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   102
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   103
    "Created: / 07-09-2011 / 17:34:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   104
!
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   105
987
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   106
cosh: f
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   107
988
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   108
%{
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   109
	RETURN ( _MKFLOAT( jcosh ( __floatVal ( f ) ) ) );
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   110
%}
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   111
987
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   112
    "Created: / 07-09-2011 / 17:08:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   113
!
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   114
988
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   115
expm1:arg
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   116
    self shouldImplement
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   117
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   118
    "Created: / 07-09-2011 / 17:34:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   119
!
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   120
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   121
floor:arg
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   122
    self shouldImplement
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   123
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   124
    "Created: / 07-09-2011 / 17:33:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   125
!
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   126
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   127
sin:arg
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   128
    self shouldImplement
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   129
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   130
    "Created: / 07-09-2011 / 17:32:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   131
!
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   132
987
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   133
sinh: f
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   134
988
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   135
%{
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   136
	RETURN ( _MKFLOAT( jsinh ( __floatVal ( f ) ) ) );
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   137
%}
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   138
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   139
987
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   140
    "Created: / 07-09-2011 / 17:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
988
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   141
!
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   142
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   143
tanh:arg
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   144
    self shouldImplement
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   145
414a2c9a6a9e Java-style FP math natives and support methods
vranyj1
parents: 987
diff changeset
   146
    "Created: / 07-09-2011 / 17:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
987
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   147
! !
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   148
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   149
!JavaMathSupport class methodsFor:'documentation'!
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   150
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   151
version_SVN
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   152
    ^ '$Id$'
7ce13ad78d68 - build targets for building fdlibm
vranyj1
parents:
diff changeset
   153
! !