[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[libm] Mathematical functions

SwikiCodeRobot @> #testLibmMathematicalFunctions

"acos - inverse cosine (arc cosine) of the input value"
(LibM current acos: 0.1) = 1.4706289056333368 ifFalse: [ self error: 'Wrong result' ].
(LibM current acos: 5.1) isNumber ifTrue: [ self error: 'Must be NAN' ].
(LibM current acosf: 0.1) = 1.4706288576126099 ifFalse: [ self error: 'Wrong result' ].


"ceil - find the nearest integer greater than or equal to x"
(LibM current ceil: 1.1) = 2 ifFalse: [ self error: 'Wrong result' ].


"atan2 - inverse tangent (arc tangent)"
(LibM current atan2: 0.5 y: 1) =  0.4636476090008061 ifFalse: [ self error: 'Wrong result' ].


"log10 - base 10 logarithm of x"
(LibM current log10: 0.5) = -0.3010299956639812 ifFalse: [ self error: 'Wrong result' ].


"trunc - round their argument to the integer value"
(LibM current trunc: -10.901) = -10 ifFalse: [ self error: 'Wrong result' ].
(LibM current trunc: 7.9501) = 7 ifFalse: [ self error: 'Wrong result' ].