Changeset 16349 for branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/interpreter.h
- Timestamp:
- 12/07/18 19:51:23 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/interpreter.h
r16274 r16349 12 12 switch (in.opcode) 13 13 { 14 case OpCodes::Const: /* nothing to do */ break; 14 15 case OpCodes::Var: 15 16 { … … 105 106 break; 106 107 } 108 case OpCodes::Square: 109 { 110 in.value = std::pow(code[in.childIndex].value, 2.); 111 break; 112 } 113 case OpCodes::CubeRoot: 114 { 115 in.value = std::pow(code[in.childIndex].value, 1./3.); 116 break; 117 } 118 case OpCodes::Cube: 119 { 120 in.value = std::pow(code[in.childIndex].value, 3.); 121 break; 122 } 123 case OpCodes::Absolute: 124 { 125 in.value = std::abs(code[in.childIndex].value); 126 break; 127 } 128 case OpCodes::AnalyticalQuotient: 129 { 130 double x = code[in.childIndex].value; 131 double y = code[in.childIndex + 1].value; 132 in.value = x / std::sqrt(1 + y*y); 133 break; 134 } 135 default: in.value = NAN; 107 136 } 108 137 } … … 131 160 break; 132 161 } 162 case OpCodes::Const: /* nothing to do because buffers for constants are already set */ break; 133 163 case OpCodes::Add: 134 164 { … … 222 252 case OpCodes::Square: 223 253 { 224 square(in.buf, code[in.childIndex].buf); 225 break; 226 } 227 } 254 pow(in.buf, code[in.childIndex].buf, 2.); 255 break; 256 } 257 case OpCodes::Sqrt: 258 { 259 pow(in.buf, code[in.childIndex].buf, 1./2.); 260 break; 261 } 262 case OpCodes::CubeRoot: 263 { 264 pow(in.buf, code[in.childIndex].buf, 1./3.); 265 break; 266 } 267 case OpCodes::Cube: 268 { 269 pow(in.buf, code[in.childIndex].buf, 3.); 270 break; 271 } 272 case OpCodes::Absolute: 273 { 274 abs(in.buf, code[in.childIndex].buf); 275 break; 276 } 277 case OpCodes::AnalyticalQuotient: 278 { 279 load(in.buf, code[in.childIndex].buf); 280 analytical_quotient(in.buf, code[in.childIndex + 1].buf); 281 break; 282 } 283 default: load(in.buf, NAN); 284 } 228 285 } 229 286 }
Note: See TracChangeset
for help on using the changeset viewer.