Controlling default output precision

Unknown
edited September 2022 in Community Q&A

Hi,

As a result of the following operation, the result is printed 22 instead of 22.5. How can we change this?

set a 180
set b 4
set c 8
set d [expr $a/$b];
set e [expr $a/$c];

Best Answer

  • Nagahashi Kouta
    Nagahashi Kouta Altair Community Member
    edited September 2022 Answer ✓

    Hi , Hakan

    This should be

    set e [expr {double($a) / $c}]

Answers

  • Nagahashi Kouta
    Nagahashi Kouta Altair Community Member
    edited September 2022 Answer ✓

    Hi , Hakan

    This should be

    set e [expr {double($a) / $c}]