lepr Posted November 25, 2018 Share Posted November 25, 2018 . Link to comment Share on other sites More sharing options...
Chris_K Posted November 26, 2018 Share Posted November 26, 2018 Hi >|< This only seems to be the case if you put the equation before the units value. If you do 100px /2 then it will work fine This is however a regression from 1.6 so I shall get it reported Serif Europe Ltd - Check the latest news at www.affinity.serif.com Link to comment Share on other sites More sharing options...
Staff Ben Posted December 4, 2018 Staff Share Posted December 4, 2018 What would you expect 100 / 2px to do? What is 100 divided by 2 apples? It makes no sense. "(100 / 2) px" has the precedence of calculating the 100 / 2, then assigning the unit type - which is why that works. The unit type has higher precedence that the arithmetic operators - which is why you need the brackets. This is not a regression - I've tightened up the rules on how units types can be automatically assigned to pure values. What should the 100 be up-converted to? px? What if the document units are in mm? What then? Should it be px or mm?? In equations where you have expressed units, the operands for / need to be the same type, or the RHS must be a scalar. For the operators (+ - *) the unit type can be up-converted to match the document units if the other operand is a distance type. If the result of an expression is a pure number, we allow the conversion to the unit type of the document. SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB Link to comment Share on other sites More sharing options...
fde101 Posted December 4, 2018 Share Posted December 4, 2018 If the document unit is inches, and the user entered the expression 20cm / 10cm, am I correct that this would be interpreted as 2 inches? Link to comment Share on other sites More sharing options...
Staff Ben Posted December 4, 2018 Staff Share Posted December 4, 2018 In 1.7 it should reject it, as the result should be a strict pure number. If you wrote "(20mm / 10mm) in" it would explicitly convert the number to the literal inches value. SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB Link to comment Share on other sites More sharing options...
Staff Ben Posted December 4, 2018 Staff Share Posted December 4, 2018 This seems to be part of the current debate on how expressions should work. Users want it to intuitively convert some unassigned numbers, but there are going to be times when the automatic conversion just doesn't make sense, or the unit type used is not what the user expected. Division is the one tricky area - dividing two values of same type should produce a ratio - a pure nunber, but dividing a unit by a pure number should result in a unit. It also stems from the fact we have no concept of square units. So 2mm * 2mm = 4mm, instead of 4mm^2. So sqrt(100mm) equals 10mm. SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB Link to comment Share on other sites More sharing options...
lepr Posted December 4, 2018 Author Share Posted December 4, 2018 . Link to comment Share on other sites More sharing options...
Recommended Posts