I recompiled my graphing application for wear OS and something broke. The app displays a grid and a waveform, but the waveform is getting mis constructed. In wear, the grid is more coarse and this error is evident. I have shown the original code and a modified
sequence below. 

```
// scale Y coordinate. Input,  elevation in feet.
// Output, y position of elevation in screen coordinate

static float scaleY(double elevation) {
    double a, b, c, offsetFromTopFeet, pixelRange, feetRange, pixelsPerFoot,offsetFromTopPixels;

    // original coding
    a = maxY - elevation;              //point in terms of feet within vert scale.
    b = (bottom - top) / (maxY - minY);
    c = top + (float) (a * b);
    // return (float)c;

    // new coding
    offsetFromTopFeet = maxY - elevation;        // a
    pixelRange = bottom - top;
    feetRange = maxY - minY;
    pixelsPerFoot = pixelRange / feetRange;     // b
    offsetFromTopPixels = top + offsetFromTopFeet * pixelsPerFoot;

    return (float) offsetFromTopPixels;
}

```

The calculation of b in the original coding returns an integer result even though the variable is a double. This is what distorts the waveform. In the reconstructed code shown underneath the variable pixelsPerFoot is calculated correctly, and the graph displays correctly. I have used this routine in android application for numerous years and either I never noticed the problem, the finer grid covered it up, or something else?

My question is why does the b calculation return an integer, but the pixelsPerFoot return the correct type? Is this a programming error?