|
From: Tait <gnu...@t4...> - 2017-11-15 02:32:19
|
> > > > ceil(900e-7/12e-7) => 76.
> > > ...
> > That particular example will "misbehave" even with 64b doubles
> > (or at least it did in my test, which is why I used that
> > particular example).
>
> It does not misbehave here in gnuplot (linux x86-64 platform)
>
> I tried a few larger exponents at random, up to
> ceil(900e-101/12e-101), without tripping an error.
> Is there some particular pattern that is prone to error?
Sorry; I meant it misbehaves in a dumb little C++
program I was using to test, not in gnuplot.
#include <iostream>
#include <ios>
#include <iomanip>
#include <cmath>
int main() {
double num1 = 900e-7;
double num2 = 12e-7;
std::cout << std::setprecision(30) << std::fixed
<< num1 << std::endl
<< num2 << std::endl
<< num1/num2 << std::endl
<< std::ceil(num1/num2) << std::endl;
return 0;
}
Although as you say, it doesn't go to 76 in gnuplot,
which makes me wonder why it behaves differently.
|