Skip to content

Commit bac1519

Browse files
committed
Updated example
1 parent 2430f8a commit bac1519

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

examples/SmartRanges/SmartRanges.ino

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ Promotion is needed to be sure that the result
3131
does not overflow. The sum has the potential
3232
to fill completely a UFix<9,0>
3333
*/
34+
auto sum1 = aF + bF;
3435
Serial.print("aF+bF is of type: UFix<");
35-
Serial.print((aF + bF).getNI());
36+
Serial.print(sum1.getNI());
3637
Serial.print(",");
37-
Serial.print((aF + bF).getNF());
38+
Serial.print(sum1.getNF());
3839
Serial.println(">");
3940

4041
/*
@@ -44,10 +45,12 @@ a UFix<10,0>. There is still room for a UFix<8,0>
4445
because 256*3=768 and the maximum a UFix<10,0> can
4546
hold is 1023.
4647
*/
48+
49+
auto sum2 = aF + bF + cF;
4750
Serial.print("aF+bF+cF is of type: UFix<");
48-
Serial.print((aF + bF + cF).getNI());
51+
Serial.print(sum2.getNI());
4952
Serial.print(",");
50-
Serial.print((aF + bF + cF).getNF());
53+
Serial.print(sum2.getNF());
5154
Serial.println(">");
5255

5356

@@ -57,10 +60,11 @@ FixMath does not promote here and
5760
aF+bF+cF has the same type than
5861
aF+bF+cF+dF.
5962
*/
63+
auto sum3 = aF + bF + cF + dF;
6064
Serial.print("aF+bF+cF+dF is of type: UFix<");
61-
Serial.print((aF + bF + cF + dF).getNI());
65+
Serial.print(sum3.getNI());
6266
Serial.print(",");
63-
Serial.print((aF + bF + cF + dF).getNF());
67+
Serial.print(sum3.getNF());
6468
Serial.println(">");
6569

6670
Serial.println();

0 commit comments

Comments
 (0)