> Nice, but part of the reason the C version is slow is that you are using abs instead of fabs. abs takes an int as an argument (this should be a compiler warning!) – passing a double other than zero always returns a large number. The C version is basically iterating till the error is below double’s resolution.
> Excellent point! Making the switch to fabs brings the gcc-inline speed down almost exactly to what Stalin is getting.
> Simple benchmark (vs C (gcc), Stalin wins)
Did you read the comments?
> Nice, but part of the reason the C version is slow is that you are using abs instead of fabs. abs takes an int as an argument (this should be a compiler warning!) – passing a double other than zero always returns a large number. The C version is basically iterating till the error is below double’s resolution.
> Excellent point! Making the switch to fabs brings the gcc-inline speed down almost exactly to what Stalin is getting.