excel_to_code 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc48f2c7f7378a3d45c86a827af3c80b3c1ab8bb
4
- data.tar.gz: e84171c4cb7380e50a5434164efa9198e884759c
3
+ metadata.gz: de50bb7417dea65e89b3e044864df9d88fe1bb7c
4
+ data.tar.gz: dbd11e7e284285b9f311ee6e4c983876d066a38c
5
5
  SHA512:
6
- metadata.gz: 609979d34c54cd18f4bc08acc769627446b570b53598b461699046e55d73dd0f6e5c43dd924a6a83901e45bfbd0e2df39b82e19c5187d06c80990b568efd4229
7
- data.tar.gz: b476571f0dc5771d85209c256b03cd0d51fbc5948c4efadc2ad35ce48c944143b79c731923f91516d2056820a5f42d0b05bcb254190a65e08bd9093eda9bf08c
6
+ metadata.gz: 6e60e361d77daad8e9d4ce9ddc5ad3d483c3af24089d085440482502305cc45dfadadf416ab814ed8e66f0e41541e8cc3bfbeae9b560ebdd5c9fe67d766f2679
7
+ data.tar.gz: bb745e1c9a5e6dc3d9ecfcc2b52c70ea9da644e2fba18dbdacb0d6ee11e999e42f5976d559d2b2e876c8abdf6c7be1002053bf62546d4209d0466d3ae6915c9a
data/src/compile/c/a.out CHANGED
Binary file
@@ -68,6 +68,7 @@ static ExcelValue left(ExcelValue string_v, ExcelValue number_of_characters_v);
68
68
  static ExcelValue left_1(ExcelValue string_v);
69
69
  static ExcelValue excel_log(ExcelValue number);
70
70
  static ExcelValue excel_log_2(ExcelValue number, ExcelValue base);
71
+ static ExcelValue excel_exp(ExcelValue number);
71
72
  static ExcelValue max(int number_of_arguments, ExcelValue *arguments);
72
73
  static ExcelValue min(int number_of_arguments, ExcelValue *arguments);
73
74
  static ExcelValue mmult(ExcelValue a_v, ExcelValue b_v);
@@ -311,6 +312,14 @@ static ExcelValue excel_log_2(ExcelValue number_v, ExcelValue base_v) {
311
312
  return new_excel_number(log(n)/log(b));
312
313
  }
313
314
 
315
+ static ExcelValue excel_exp(ExcelValue number_v) {
316
+ CHECK_FOR_PASSED_ERROR(number_v)
317
+ NUMBER(number_v, n)
318
+ CHECK_FOR_CONVERSION_ERROR
319
+
320
+ return new_excel_number(exp(n));
321
+ }
322
+
314
323
  static ExcelValue excel_and(int array_size, ExcelValue *array) {
315
324
  int i;
316
325
  ExcelValue current_excel_value, array_result;
@@ -745,6 +745,15 @@ int test_functions() {
745
745
  assert(excel_isnumber(TRUE).type == ExcelBoolean);
746
746
  assert(excel_isnumber(TRUE).number == 0);
747
747
 
748
+ // Test the EXP function
749
+ assert(excel_exp(BLANK).number == 1);
750
+ assert(excel_exp(ZERO).number == 1);
751
+ assert(excel_exp(ONE).number == 2.718281828459045);
752
+ assert(excel_exp(new_excel_string("1")).number == 2.718281828459045);
753
+ assert(excel_exp(FALSE).number == 1);
754
+ assert(excel_exp(TRUE).number == 2.718281828459045);
755
+ assert(excel_exp(DIV0).type == ExcelError);
756
+
748
757
  // Release memory
749
758
  free_all_allocated_memory();
750
759
 
@@ -35,6 +35,7 @@ class MapFormulaeToC < MapValuesToC
35
35
  :'COSH' => 'cosh',
36
36
  :'COUNT' => 'count',
37
37
  :'COUNTA' => 'counta',
38
+ :'EXP' => 'excel_exp',
38
39
  :'FIND2' => 'find_2',
39
40
  :'FIND3' => 'find',
40
41
  :'HLOOKUP3' => 'hlookup_3',
@@ -25,6 +25,7 @@ class MapFormulaeToRuby < MapValuesToRuby
25
25
  :'COSH' => 'cosh',
26
26
  :'COUNT' => 'count',
27
27
  :'COUNTA' => 'counta',
28
+ :'EXP' => 'exp',
28
29
  :'FIND' => 'find',
29
30
  :'HLOOKUP' => 'hlookup',
30
31
  :'IF' => 'excel_if',
@@ -96,3 +96,5 @@ require_relative 'excel_functions/len'
96
96
  require_relative 'excel_functions/substitute'
97
97
 
98
98
  require_relative 'excel_functions/lower'
99
+
100
+ require_relative 'excel_functions/exp'
@@ -0,0 +1,10 @@
1
+ module ExcelFunctions
2
+
3
+ def exp(a)
4
+ a = number_argument(a)
5
+ return a if a.is_a?(Symbol)
6
+
7
+ Math.exp(a)
8
+ end
9
+
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excel_to_code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Counsell, Green on Black Ltd
@@ -151,6 +151,7 @@ files:
151
151
  - src/excel/excel_functions/excel_equal.rb
152
152
  - src/excel/excel_functions/excel_if.rb
153
153
  - src/excel/excel_functions/excel_match.rb
154
+ - src/excel/excel_functions/exp.rb
154
155
  - src/excel/excel_functions/find.rb
155
156
  - src/excel/excel_functions/hlookup.rb
156
157
  - src/excel/excel_functions/iferror.rb