From: theozh <th...@gm...> - 2017-11-14 21:39:40
|
as described in gnuplot help, gnuplot does integer divison if the dividend and the divisors are integers. As a normal user, you don't expect this and you will learn about this "pitfall" when you're wondering why you get wrong plotting results (or if you read the manual from the beginning to the end and will stumble across it). How to force a floating point division with two integer variables, e.g. in loops? The only way I found is to multiply the first number by 1.0 Is this really the way to go? Example: do for [i=1:6] { do for [j=1:6] { print sprintf("%g\t%g",i/j,i*1./j) } } Isn't there maybe a way to set a flag to always use floating point divison? |