[Issue 23846] std.math can't compile under macos rosetta
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 26 03:41:50 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23846
--- Comment #7 from Caleb Xu <calebcenter at live.com> ---
Good catch, the example program was not checking errno. I've repeated the test
with a slightly modified example program:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main() {
float float1 = strtof("0x0.8p-126f", NULL);
printf("%s\n", (float1 != 0) ? "true" : "false");
printf("%d\n", errno);
float float2 = strtof("0x0.555556p-126f", NULL);
printf("%s\n", (float2 != 0) ? "true" : "false");
printf("%d\n", errno);
double double1 = strtod("0x0.8p-1022", NULL);
printf("%s\n", (double1 != 0) ? "true" : "false");
printf("%d\n", errno);
double double2 = strtod("0x0.5555555555555p-1022", NULL);
printf("%s\n", (double2 != 0) ? "true" : "false");
printf("%d\n", errno);
}
This time, the output with the newer Xcode toolchain is:
true
34
true
34
true
34
true
34
So looks like errno is indeed ERANGE here.
--
More information about the Digitalmars-d-bugs
mailing list