On Thursday, 14 September 2023 at 03:23:48 UTC, An Pham wrote:
import std.stdio;
void main()
{
float f = 6394763.345f;
import std.format : sformat;
char[80] vBuffer = void;
writeln("6394763.345 = ", sformat(vBuffer[], "%.4f",
f));
On Wednesday, September 13, 2023 9:23:48 PM MDT An Pham via Digitalmars-d-
learn wrote:
> import std.stdio;
>
> void main()
> {
> float f = 6394763.345f;
>
> import std.format : sformat;
>
> char[80] vBuffer = void;
> writeln("6394763.345 = ", sformat(v
import std.stdio;
void main()
{
float f = 6394763.345f;
import std.format : sformat;
char[80] vBuffer = void;
writeln("6394763.345 = ", sformat(vBuffer[], "%.4f", f));
}
Output
6394763.345 = 6394763.5000
On 03/03/2017 05:39 PM, ag0aep6g wrote:
dmd generates SSE instructions for floating point math.
FloatingPointControl only minds the control register for the FPU. But
SSE instructions are not affected by that. SSE has a separate control
register: MXCSR.
I've filed an issue:
https://issues.dl
On 03/02/2017 10:49 PM, Guillaume Chatelet wrote:
Thx for the investigation!
Here is the code for FloatingPointControl
https://github.com/dlang/phobos/blob/master/std/math.d#L4809
Other code (enableExceptions / disableExceptions) seems to have two code
path depending on "version(X86_Any)", round
On Thursday, 2 March 2017 at 21:34:56 UTC, ag0aep6g wrote:
On 03/02/2017 10:10 PM, Guillaume Chatelet wrote:
On Thursday, 2 March 2017 at 20:30:47 UTC, Guillaume Chatelet
wrote:
Here is the same code in D:
void main(string[] args)
{
import std.math;
FloatingPointControl fpctrl;
fpct
On 03/02/2017 10:10 PM, Guillaume Chatelet wrote:
On Thursday, 2 March 2017 at 20:30:47 UTC, Guillaume Chatelet wrote:
Here is the same code in D:
void main(string[] args)
{
import std.math;
FloatingPointControl fpctrl;
fpctrl.rounding = FloatingPointControl.roundUp;
writefln("%.
On Thursday, 2 March 2017 at 20:30:47 UTC, Guillaume Chatelet
wrote:
Here is the same code in D:
void main(string[] args)
{
import std.math;
FloatingPointControl fpctrl;
fpctrl.rounding = FloatingPointControl.roundUp;
writefln("%.32g", float.min_normal + 1.0f);
}
Execution on my
I would expect that (1.0f + smallest float subnormal) > 1.0f when
the Floating Point unit is set to Round Up.
Here is some C++ code:
#include
#include
#include
int main(int, char**) {
std::fesetround(FE_UPWARD);
printf("%.32g\n", std::numeric_limits::denorm_min() +
1.0f);
retur