[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] Followup: found work-around formissing~/swarmarchive
From: |
Bill Northcott |
Subject: |
Re: [Swarm-Support] Followup: found work-around formissing~/swarmarchiver.scm too |
Date: |
Thu, 17 Aug 2006 18:14:09 +1000 |
On 17/08/2006, at 11:10 AM, Marcus G. Daniels wrote:
Bill Northcott wrote:
On 16/08/2006, at 4:42 AM, Paul Johnson wrote:
Yesterday I was bug shooting a problem in and older FC4 and found
that gcc treats 50 differently than 50.0 when used as a (double)
parameter in a draw from a normal distribution, and the value 50
was converted to 0. It does not do that anymore in FC5.
.....
2 When a value of integer type is converted to a real floating
type, if the value being converted can be represented exactly in
the new type, it is unchanged. If the value being converted is in
the range of values that can be represented but cannot be
represented exactly, the result is either the nearest higher or
nearest lower representable value, chosen in an implementation-
defined manner. If the value being converted is outside the range
of values that can be represented, the behavior is undefined.
[50] The remainder operation performed when a value of integer
type is converted to unsigned type need not be performed when a
value of real floating type is converted to unsigned type. Thus,
the range of portable real floating values is (-1 Utype_MAX+1).
--
One way a problem could occur is if a prototype was missing. That
is, if the compiler didn't have a declaration for the method. Or
perhaps it is a bug in the compiler.
I don't think it is the compiler. Or if it is, it is not down to Apple
This code:
#include <stdio.h>
double dblfunction(double dbl);
double dblfunction(double dbl) {
return dbl;
}
int main (int argc, const char * argv[]) {
printf("The result is %6.2f\n", dblfunction(50));
return 0;
}
Produces this result with Xcode 2.4, which would seem to agree with
the standard quoted by Marcus.
[Session started at 2006-08-17 18:00:36 +1000.]
The result is 50.00
Float test has exited with status 0.
Bill
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Swarm-Support] Followup: found work-around formissing~/swarmarchiver.scm too,
Bill Northcott <=