tbmx 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/tbmx.rb +26 -42
  2. metadata +3 -2
data/lib/tbmx.rb CHANGED
@@ -294,48 +294,32 @@ module TBMX
294
294
  "#{Math::PI}"
295
295
  when "e"
296
296
  "#{Math::E}"
297
- when "+"
298
- reducable_math_function_handler :+
299
- when "-"
300
- reducable_math_function_handler :-
301
- when "*"
302
- reducable_math_function_handler :*
303
- when "/"
304
- reducable_math_function_handler :/
305
- when "sin"
306
- math_function_handler :sin
307
- when "cos"
308
- math_function_handler :cos
309
- when "tan"
310
- math_function_handler :tan
311
- when "asin"
312
- math_function_handler :asin
313
- when "acos"
314
- math_function_handler :acos
315
- when "atan"
316
- math_function_handler :atan
317
- when "sinh"
318
- math_function_handler :sinh
319
- when "cosh"
320
- math_function_handler :cosh
321
- when "tanh"
322
- math_function_handler :tanh
323
- when "asinh"
324
- math_function_handler :asinh
325
- when "acosh"
326
- math_function_handler :acosh
327
- when "atanh"
328
- math_function_handler :atanh
329
- when "erfc"
330
- math_function_handler :erfc
331
- when "gamma"
332
- math_function_handler :gamma
333
- when "lgamma"
334
- math_function_handler :lgamma
335
- when "log10"
336
- math_function_handler :log10
337
- when "log2"
338
- math_function_handler :log2
297
+ when "+", "-", "*", "/", "%"
298
+ reducable_math_function_handler command.word.to_sym
299
+ when "^", "**"
300
+ number, exponent = numbers_from_expressions
301
+ number.send :**, exponent
302
+ when "sin", "cos", "tan",
303
+ "asin", "acos", "atan",
304
+ "sinh", "cosh", "tanh",
305
+ "asinh", "acosh", "atanh",
306
+ "erf", "erfc",
307
+ "gamma", "lgamma",
308
+ "log10", "log2",
309
+ "sqrt"
310
+ math_function_handler command.word.to_sym
311
+ when "log"
312
+ base, number = numbers_from_expressions
313
+ if number.nil?
314
+ Math.log base
315
+ else
316
+ Math.log number, base
317
+ end
318
+ when "ldexp"
319
+ fraction, exponent = numbers_from_expressions
320
+ Math.ldexp fraction, exponent
321
+ when "hypot"
322
+ Math.sqrt numbers_from_expressions.map {|n| n**2}
339
323
  else
340
324
  command_error "unknown command #{command.to_html}"
341
325
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbmx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-23 00:00:00.000000000 Z
12
+ date: 2014-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -75,3 +75,4 @@ signing_key:
75
75
  specification_version: 3
76
76
  summary: TBMX is a markup language for ThinkingBicycle.com.
77
77
  test_files: []
78
+ has_rdoc: