Sandbox: Difference between revisions

testing syntax highlighting
m (WP template test)
(testing syntax highlighting)
Line 5:
 
[[#Your Language Here]]
 
 
== Syntax highlighting ==
<c>#include <iostream>
#include <gmpxx.h>
 
mpf_class f(mpf_class x);
double f(double x);
 
int main()
{
unsigned int start = 1;
unsigned int end = 1000;
mpf_class sum = 0;
double dsum = 0;
for( unsigned int x = start;
x <= end;
++x )
{
sum += f(mpf_class(x));
dsum += f((double) x);
}
std::cout << "Sum of f(x) from " << start << " to " << end << " is " << sum << " (GMP float) or " << dsum << " (IEEE 64-bit float)" << std::endl;
return 0;
}
 
 
mpf_class f(mpf_class x)
{
return ( 1 / ( x * x ) );
}
 
double f(double x)
{
return ( 1 / ( x * x ) );
}
</c>
 
== Expression test ==