I am writing maps for ZeppOS in JS using 256 by 256 raster Tiles. Using the official Wiki, I found a formula for determining the Tile on which an object with coordinates (lon, lat) is located

However, now I need to determine at which point on the Tile itself this object is located. Please tell me what formula I need to use for this?

Strangely, I can’t find a good answer to this question on this site, but this question on the old help site seems relevant.

In case it goes missing: The lat/lon-to-tile formulas give will give you non-integral results. The integer parts are the tile numbers; the fractional parts are the position within the tile. So, if a coordinate comes out to 123.456, that is tile number 123, and pixel 0.456*256 (assuming tiles are 256 pixels across, and possibly * 255 instead, depending on how you fit non-integral coordinates to pixels…).

The problem is that formulas only return integers (((