Sha256: e901703c339d4a129dc6da366a46e7f0e77de0364b55ce4ff8e0d17d33f013d5
Contents?: true
Size: 1.15 KB
Versions: 8
Compression:
Stored size: 1.15 KB
Contents
def runmathcommand commandtext = @a_mathcommandinput.to_s begin # exception trapped block @mathcommandresult = "no result" if commandtext == "sin" @mathcommandresult = Math.sin( @a_mathtoola.to_f ) end if commandtext == "cos" @mathcommandresult = Math.cos( @a_mathtoola.to_f ) end if commandtext == "atan2" @mathcommandresult = Math.atan2( @a_mathtoola.to_f ,@a_mathtoolsb.to_f) end if commandtext == "exp" @mathcommandresult = Math.exp( @a_mathtoola.to_f ) end if commandtext == "log" @mathcommandresult = Math.log( @a_mathtoola.to_f ) end if commandtext == "log10" @mathcommandresult = Math.log10( @a_mathtoola.to_f ) end if commandtext == "sqrt" @mathcommandresult = Math.sqrt( @a_mathtoola.to_f ) end if commandtext == "tan" @mathcommandresult = Math.tan( @a_mathtoola.to_f ) end rescue SystemCallError, StandardError @mathcommandresult = "system call error: " + $! end # exception rescue end def showmathcommandoptions @mathcommandoptions = ["sin","atan2","cos","exp","log","log10","sqrt","tan"].rwd_options end
Version data entries
8 entries across 8 versions & 2 rubygems