View Full Version : float subtrack bug
ivanova
12th November 2003, 20:35
ColorBars(480,360)
Subtitle(string(700.0 - 71.7))
Subtitle(string(float(700) - 0.6),y=40)
It gives :
628.299988
699.400024
This is obviously not right, can anyone confirm this?
Using latest avisynth (2.53)
stickboy
13th November 2003, 06:03
Looks like normal floating-point behavior to me.
Are you expecting double-precision floats?
(Non-integer values generally cannot be represented exactly in binary. Therefore floating-point calculations inherently are inexact under most circumstances.)
WarpEnterprises
13th November 2003, 22:29
ivanova may be right, it is a bit more than only "normal" floating point.
It seems it comes from internal conversions BETWEEN float and double:
double AsFloat() const { _ASSERTE(IsFloat()); return IsInt()?integer:floating_pt; }
...
float floating_pt;
The variable is float and is then returned as double.
stickboy
14th November 2003, 02:17
Returning a single-precision float as a double shouldn't introduce additional error (although the conversion seems totally unnecessary), and the values that ivanova gave are consistent with single-precision floating point arithmetic.
I always had assumed that AviSynth used single-precision floats anyway, and I never expected anything beyond that... (I can't find anything in the docs that says anything about it.)
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.