Mercurial > hg > octave-max
comparison src/mappers.cc @ 10903:9f0f1a89c704
Add new %!tests for negative integer arguments to gamma, lgamma.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 21 Aug 2010 11:15:44 -0700 |
parents | 89f4d7e294cc |
children | ef0e995f8c0f |
comparison
equal
deleted
inserted
replaced
10902:9a64e02e2aad | 10903:9f0f1a89c704 |
---|---|
914 %!test | 914 %!test |
915 %! x = single([.5, 1, 1.5, 2, 3, 4, 5]); | 915 %! x = single([.5, 1, 1.5, 2, 3, 4, 5]); |
916 %! v = single([sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]); | 916 %! v = single([sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]); |
917 %! assert(gamma(x), v, sqrt(eps('single'))) | 917 %! assert(gamma(x), v, sqrt(eps('single'))) |
918 | 918 |
919 %!test | |
920 %! x = [-1, 0, 1, Inf]; | |
921 %! v = [NaN, Inf, 1, Inf]; | |
922 %! assert (gamma(x), v); | |
923 %! assert (gamma(single (x)), single (v)); | |
924 | |
919 %!error gamma(); | 925 %!error gamma(); |
920 %!error gamma(1,2); | 926 %!error gamma(1,2); |
921 | 927 |
922 */ | 928 */ |
923 | 929 |
1291 | 1297 |
1292 %!test | 1298 %!test |
1293 %! x = single([.5, 1, 1.5, 2, 3, 4, 5]); | 1299 %! x = single([.5, 1, 1.5, 2, 3, 4, 5]); |
1294 %! v = single([sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]); | 1300 %! v = single([sqrt(pi), 1, .5*sqrt(pi), 1, 2, 6, 24]); |
1295 %! assert(lgamma(x), log(v), sqrt(eps ('single'))) | 1301 %! assert(lgamma(x), log(v), sqrt(eps ('single'))) |
1302 | |
1303 %!test | |
1304 %! x = [-1, 0, 1, Inf]; | |
1305 %! v = [Inf, Inf, 0, Inf]; | |
1306 %! assert (lgamma(x), v); | |
1307 %! assert (lgamma(single (x)), single(v)); | |
1296 | 1308 |
1297 %!error lgamma(); | 1309 %!error lgamma(); |
1298 %!error lgamma(1,2); | 1310 %!error lgamma(1,2); |
1299 | 1311 |
1300 */ | 1312 */ |