This script will calculate the probability of successfully reading an uncursed spellbook.
Blessed spellbooks can always be successfully read. Cursed spellbooks will never be successfully read. If you unsuccessfully read a spellbook, you receive a bad effect.
If you're a Wizard, you'll be warned before trying to read any uncursed spellbook when your success is less than 100%.
See spl1-343 for details on the effects of failing to read a spellbook, and levels for each spellbook.