Search found 262 matches

by Josef Templ
Tue Nov 25, 2014 4:45 pm
Forum: Component Pascal
Topic: Quick Quiz #1 - DIV and MOD
Replies: 11
Views: 23566

Re: Quick Quiz #1 - DIV and MOD

Please note that C does not have a MOD operator at all (if I remember correctly). It has a 'remainder' operator. Most CPUs have a remainder operation in hardware, not a MOD operation. The difference shows up for negative dividends. The MOD function is actually meaningless for negative divisors becau...
by Josef Templ
Tue Nov 19, 2013 7:25 am
Forum: Component Pascal
Topic: Numerical Analysis
Replies: 13
Views: 32392

Re: Numerical Analysis

I would avoid the common sub-expression u * u + v * v by evaluating
it only once and storing it in an auxiliary variable.
This is (1) faster and (2) more predictable with respect to floating
point precision.

- Josef