How do delay and increment work, exactly? I am trying to program my own chess clock and would like it to be as accurate as possible. Suppose 2 players, player A and player B, are playing a 15 minute game with a 2 second delay. Suppose A is white, and the game begins, and player A spends 2.5 seconds on his first move before hitting the clock. The first 2 seconds are "absorbed" by the delay, but what happens when it is his turn again? He will get the 2 second delay, but will 15:00 change to 14:59 half a second after the delay has finished, essentially giving him a free half-second? Or does the fractional time get rounded up to the nearest second? Similarly with increment.
Nothing gets rounded internally. If you are programming a chess clock, then maintain the time according to whatever the machine precision is on your machine without rounding. Some clocks have tenth seconds on their display, but that doesn't mean that they're altering the fundamental increments of time as compared to different clocks.

If A begins and spends 2.5 seconds on his first move, then he will have exactly 14:59.5 left. Just because it displays 15:00 doesn't mean that he still has 15:00. If he spent 2.6 seconds, then he has exactly 14:59.4 left, which may display as 14:59.

Likewise with increment. He will have exactly 14:57.5 + 2 = 14:59.5 seconds on his clock, which may display as 15:00.