Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenIndiana: failing test float #7685

Closed
vicuna opened this issue Dec 4, 2017 · 5 comments
Closed

OpenIndiana: failing test float #7685

vicuna opened this issue Dec 4, 2017 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Dec 4, 2017

Original bug ID: 7685
Reporter: grueni
Status: confirmed (set by @xavierleroy on 2017-12-20T16:20:17Z)
Resolution: open
Priority: normal
Severity: minor
Platform: OpenIndiana
OS: OpenIndiana
OS Version: Hipster
Version: 4.06.0
Category: configure and build/install

Bug description

The test fails because the first letter of the result is capitalized.

Additional information

--- ocaml-4.06.0/testsuite/tests/basic/float.reference.orig 2017-12-04 18:33:56.140895262 +0000
+++ ocaml-4.06.0/testsuite/tests/basic/float.reference 2017-12-04 18:34:06.093706170 +0000
@@ -1 +1 @@
-1./.0. = inf
+1./.0. = Inf

@vicuna
Copy link
Author

vicuna commented Dec 20, 2017

Comment author: @xavierleroy

I'm not sure who is wrong: the %f format of OCaml that relies on the C library sprintf() function to print infinities and other special FP values (unless HAS_BROKEN_PRINTF is defined), or the test because it assumes a specific printout for those values. At any rate the problem is not specific to OpenIndiana, it's just triggered by OpenIndiana.

@vicuna
Copy link
Author

vicuna commented Dec 20, 2017

Comment author: @xavierleroy

It gets worse. According to C99:

A double argument representing an infinity is converted in one of the styles
[-]inf or [-]infinity — which style is implementation-defined.

So, OpenIndiana's "Inf" is not C99-compliant. But assuming "inf" to be the result of the test is wrong as well...

@vicuna
Copy link
Author

vicuna commented Dec 21, 2017

Comment author: grueni

Maybe a solution is to use a function to test for infinity. This should solve the differences in the implementations.

I have no idea how to do it in ocaml.
In C:
#include <stdio.h>
#include <math.h>

int main()
{
double a = 1.0/0.0;
printf("1./.0 = %f\n",a);
printf("1./.0 = Inf %s\n",isinf(a)?"true":"false");
return 0;
}

And the reference would be:
1./.0 = Inf true

@vicuna
Copy link
Author

vicuna commented Mar 20, 2018

Comment author: @rixed

Many people, including myself, expect %F to print in a format not only compatible with float_of_string, but also with the OCaml parser. Meaning infinity should be printed as "infinity" and "neg_infinity".

This seems to be a problem that keeps reappearing:

#2724
#8233
#4688
#5739

Would that change be accepted?

@github-actions
Copy link

github-actions bot commented May 7, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 7, 2020
@github-actions github-actions bot closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant