Income tax calculation is wrong

Clues like this may shed light

Some test case trial and error learning with say a spreadsheet will work too?