phobos 0.138

This commit is contained in:
Brad Roberts 2007-09-10 04:55:20 +00:00
parent 0db21d681e
commit d53da65c02
2 changed files with 2 additions and 23 deletions

View file

@ -50,6 +50,7 @@ module std.math;
//debug=math; // uncomment to turn on debugging printf's
private import std.stdio;
private import std.c.stdio;
private import std.string;
private import std.c.math;
@ -1641,7 +1642,7 @@ body
}
else
{
i = A.length - 1;
int i = A.length - 1;
real r = A[i];
while (--i >= 0)
{

View file

@ -114,28 +114,6 @@ unittest
assert(feq(frac(-123.456), -0.456L));
}
/*********************************
* Polynomial of X
*/
real poly(real x, real[] coefficients)
{
debug (math2) printf("poly(), coefficients.length = %d\n", coefficients.length);
if (!coefficients.length)
return 0;
real result = coefficients[coefficients.length - 1];
for (int i = coefficients.length - 2; i >= 0; i--)
result = result * x + coefficients[i];
return result;
}
unittest
{
debug (math2) printf("unittest.poly()\n");
static real[4] k = [ 4, 3, 2, 1 ];
assert(feq(poly(2, k), cast(real) 8 * 1 + 4 * 2 + 2 * 3 + 4));
}
/*********************************
* Sign
*/