Skip to content

Instantly share code, notes, and snippets.

@erique
Created September 15, 2022 22:25
Show Gist options
  • Save erique/d6ff19dbfc7c810fd89e6070186768bb to your computer and use it in GitHub Desktop.
Save erique/d6ff19dbfc7c810fd89e6070186768bb to your computer and use it in GitHub Desktop.
calling mathieeedoubbas fails
// m68k-amigaos-gcc -noixemul -m68060 -lm ceil_error.c -o ceil_error
#include <stdio.h>
#include <math.h>
int main()
{
printf("GCC %s\n", __VERSION__);
double value = 3.125;
uint64_t clamped = (uint64_t)ceil(value);
printf("clamped = %08llx ; %s\n", clamped, (clamped == 4) ? "PASS" : "FAIL");
return clamped;
}
@erique
Copy link
Author

erique commented Sep 15, 2022

GCC 6.5.0b 220915211933
clamped = fffffffc ; FAIL
TBL1:ceil_error failed returncode -4

@erique
Copy link
Author

erique commented Sep 15, 2022

00001068 00001068 _ceil:
    1068:       2f0e            move.l a6,-(sp)
    106a:       202f 0008       move.l 8(sp),d0
    106e:       222f 000c       move.l 12(sp),d1
    1072:       2c79 0000 0114  movea.l 114 114 _MathIeeeDoubBasBase,a6
    1078:       4eae ffa0       jsr -96(a6)
    107c:       2c5f            movea.l (sp)+,a6
    107e:       4e75            rts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment