Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
import std.stdio, std.math, std.conv, std.algorithm, std.array;
|
||||
|
||||
double f(in double x) pure nothrow {
|
||||
return x.abs.sqrt + 5 * x ^^ 3;
|
||||
}
|
||||
|
||||
void main() {
|
||||
double[] data;
|
||||
|
||||
while (true) {
|
||||
"Please enter eleven numbers on a line: ".write;
|
||||
data = readln.split.map!(to!double).array;
|
||||
if (data.length == 11)
|
||||
break;
|
||||
writeln("Those aren't eleven numbers.");
|
||||
}
|
||||
foreach_reverse (immutable x; data) {
|
||||
immutable y = x.f;
|
||||
writefln("f(%0.3f) = %s", x, y > 400 ? "Too large" : y.text);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue