D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14969 - cannot evaluate atan at compile time
Summary: cannot evaluate atan at compile time
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 minor
Assignee: No Owner
URL:
Keywords: CTFE
Depends on:
Blocks:
 
Reported: 2015-08-27 05:58 UTC by yosikawa
Modified: 2022-10-10 09:31 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description yosikawa 2015-08-27 05:58:37 UTC
import std.math;
enum foo = atan(1.0);

above code failed to compile using
DMD32 D Compiler v2.068.0

Building Debug\T38DTest.exe...
C:\APP\D\dmd2\windows\bin\..\..\src\phobos\std\math.d(1135): Error: asm statements cannot be interpreted at compile time
C:\APP\D\dmd2\windows\bin\..\..\src\phobos\std\math.d(1023):        called from here: atan2(x, 1.00000L)
C:\APP\D\dmd2\windows\bin\..\..\src\phobos\std\math.d(1087):        called from here: atan(cast(real)x)
main.d(2):        called from here: atan(1.00000)
Comment 1 mw 2020-05-23 05:40:04 UTC
I hit this problem today.

dmd2/linux/bin64/../../src/phobos/std/math.d(5288,22): Error: asm statements cannot be interpreted at compile time
source/money.d(716,21):        called from here: lrint(x)
source/money.d(87,31):        called from here: round(cast(real)(x * cast(double)pow10(4)), cast(roundingMode)2)
source/money.d(87,25):        called from here: to(round(cast(real)(x * cast(double)pow10(4)), cast(roundingMode)2))


And found previous discussion and solution here:

https://forum.dlang.org/post/jtlhocbfcignwhbntgrv@forum.dlang.org


Not sure if this bug can be fixed.

$ dmd --version
DMD64 D Compiler v2.092.0
Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved written by Walter Bright

on  x86_64 GNU/Linux
Comment 2 RazvanN 2022-10-10 09:31:24 UTC
I cannot reproduce this. This seems to have been fixed.