![]() Indeed, the dimension of second is time, while meter denotes a length, thus they cannot be compared, added, etc. Simply put, it prevents comparing apples and pears: If you try to convert seconds to meters, SpeedCrunch will complain, stating that the dimensions of second and meter do not match. The order explicit by using newton / (centi meter).įor the same reasons, expressions like 500 gram / 20 gram and (500 gram) / (20 gram) yield different results.Īn important feature of SpeedCrunch’s unit system is dimensional checking. ‘newtons per centimeter’, don’t simply type newton / centi meter – this will be interpreted as (newton / centi) meter! Instead, make For instance, if you intend to express the unit Means that their use follows the same rules of precedence as any other mathematical operation. This limitation (or feature, depending on your point of view) In SpeedCrunch (unlike in textbook notation), prefixes can be used on their own. In that case, the imaginary part of these numbers is discarded when passing them as an argument to a built-in function. However, previously stored variables may still contain complex values. When complex numbers are disabled, the constant j is not available. However, when given a real argument, cbrt() will always return the real cubic root, regardless of whether or not complex numbers are enabled. With complex number support enabled, the power operation x^(1/3) will return the first complex cubic root of x which is usually non-real. Refer to a function’s documentation for more information.Ĭaution is advised when using functions like cbrt() or any fractional power operation with complex numbers. Not every function in SpeedCrunch supports complex arguments. Simply defining i=j allows you to use i as an alias for j. Although SpeedCrunch does not support this notation by default, it is added easily enough. Some users (especially mathematicians or physicists) may prefer to use the letter i for the imaginary unit. If necessary, consider writing the multiplication explicitly, i.e. Looks okay to me, but the math module is not really "my" part.J ^ 2 = -1 ( 5 + 3 j ) / ( 8 - 2 j ) = 0.5+0.5jĪ note on the syntax of complex numbers: 5j denotes the number 5*j while j5 is a variable named ‘j5’. I have fixed the build, but I did not intend the sources for building, rather for a code review of the changes. Implementing it using operators sounds hackish to me. Also, doing it that way we can add support for alternative notations ( °'" and hms, although the latter will probably be confused with the alternative hexadecimal notation by users and reserve one letter keywords). I think it should be part of the lexer ( Evaluator::scan() and floatio.c:parse()) as it is just another number format like hexadecimal, octal, and binary. I'd prefer to treat it properly as the operator it is. Hmm, the literal parser is already cumbersome enough. Is there a specific reason for using minutes as the base unit instead of seconds? Is the fractional minutes notation ( hh:mm.frac) that common?Īlso, I believe the main purpose of that issue is to support degrees in trigonometric functions, so there should be a conversion to radian somewhere (using units?). 1, 23 and 45.6 in the above example) in any base other than decimal, so introducing a new value for the format (e.g. I assume there is no need to display the resulting 'digits' (i.e. Granted, 0:0:30 still takes longer to type than 30", and arguably more than 30/3600, but the idea sounds reasonable to me.įinally for displaying the output in sexagesimal format we'd need a function like sexa to do the job. ![]() Plus, by interpreting a:b simply as an infix notation for a + b/60, it should be super easy to implement. The notation 1:23:45.6 on the other hand seems very appalling. (The problem with the notation is that it contains an implied addition, 1°+23', while generally in mathematical notation only multiplication can be implicit. Finally we'll have to deal with a lot of new tokens:Īnd all possible combinations of those need to yield defined behavior. hours or minutes), and the separators ( °, '.) can either be used as infix or postfix operators ( ° resp. For once, it can be used in a multitude of variations (omitting e.g. I see a lot of potential for trouble using it. ![]() ![]() While the notation 1☂3'45.6" is certainly common, I'm not sure I'm sold on it for SpeedCrunch. ![]()
0 Comments
Leave a Reply. |