about summary refs log tree commit diff stats
path: root/001help.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-08 11:23:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-08 11:23:32 -0700
commit7426258146a0ddb624ab5def394ad38611c7caff (patch)
tree7cb8d440a5eeb9a9ce024fc3d597bb1f9f517d73 /001help.cc
parent32d4af5458a97152f19b97af664cf22599e1b3fd (diff)
downloadmu-7426258146a0ddb624ab5def394ad38611c7caff.tar.gz
3305 - show all available precision in numbers
Thanks Ella Couch for pointing out that Mu was lying when debugging
small numbers.

  def main [
    local-scope
    x:number <- copy 1
    {
      x <- divide x, 2
      $print x, 10/newline
      loop  # until SIGFPE
    }
  ]
Diffstat (limited to '001help.cc')
-rw-r--r--001help.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/001help.cc b/001help.cc
index 351ae27a..8a092ffa 100644
--- a/001help.cc
+++ b/001help.cc
@@ -172,7 +172,8 @@ feenableexcept(FE_OVERFLOW | FE_UNDERFLOW);
 //? assert(sizeof(int) == 4 && sizeof(float) == 4);
 //? //                          | exp   |  mantissa
 //? int smallest_subnormal = 0b00000000000000000000000000000001;
-//? float smallest_subnormal_f = *reinterpret_cast<int*>(&smallest_subnormal);
+//? float smallest_subnormal_f = *reinterpret_cast<float*>(&smallest_subnormal);
+//? cerr << "ε: " << smallest_subnormal_f << '\n';
 //? cerr << "ε/2: " << smallest_subnormal_f/2 << " (underflow)\n";  // test SIGFPE
 :(before "End Includes")
 #include <fenv.h>