Changes between Version 9 and Version 10 of Troubleshooting
- Timestamp:
- 11/22/10 20:26:42 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Troubleshooting
v9 v10 7 7 Symptoms include error messages you weren't expecting about method calls and "float" arguments: 8 8 {{{ 9 #!cobra 9 10 obj.foo(1.0, 1.0) # error: Cannot convert... 10 11 }}} … … 16 17 One of these types has to be the default type for values such as "1.0" and "x/y". Cobra uses "decimal" because it is more accurate with respect to the base-10 numbers people normally work with (e.g., 10%, 1.6). However, some libraries--especially for graphics and games--expect binary floating point numbers. If your application is oriented towards such numbers you can change the default number type by placing this in your code: 17 18 {{{ 19 #!cobra 18 20 @number float64 19 21 }}} 20 22 Or passing it at the command line: 21 23 {{{ 24 #!cobra 22 25 cobra -number:float64 ... 23 26 }}} … … 26 29 If you only need the occasional float, you can use suffixes like "_f64" and "_f32" (or "_d" for decimal): 27 30 {{{ 31 #!cobra 28 32 obj.foo(1.0_f32, 1.0_f32) 29 33 }}} … … 40 44 or with a directive in a source file: 41 45 {{{ 46 #!cobra 42 47 @args -sharp-args:"/platform:x86" 43 48 }}}