toolchain icon indicating copy to clipboard operation
toolchain copied to clipboard

`__ultof` actually implements `__ltof`

Open runer112 opened this issue 6 months ago • 2 comments

And __ltof implements a worse __ltof.

Example code demonstrating issue:

#include <ti/getcsc.h>
#include <ti/screen.h>

#include <limits.h>
#include <stdio.h>

void testl(long x) {
  printf("%11li -> %11.0f", x, (float)x);
}

void testul(unsigned long x) {
  printf("%11lu -> %11.0f", x, (float)x);
}

int main() {
  os_ClrHome();

  testl(LONG_MAX);
  testl(LONG_MIN);
  testl(ULONG_MAX);
  os_NewLine();
  testul(LONG_MAX);
  testul(LONG_MIN);
  testul(ULONG_MAX);

  while (!os_GetCSC())
    ;
}

image

runer112 avatar Dec 26 '23 00:12 runer112