Bug 8689 – Variant opArithmetic does not attempt float conversion

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-09-18T13:27:00Z
Last change time
2013-01-02T00:28:32Z
Assigned to
nobody
Creator
callumenator

Comments

Comment #0 by callumenator — 2012-09-18T13:27:20Z
Variant tries to mimic D's built-in rules for arithmetic conversions but: import std.variant, std.stdio; void main() { auto v1 = Variant(4.5f); auto v2 = Variant(3.5f); writeln((v1+v2).type()); // double (should be float) } The reason is Variant doesn't try to convert to float in opArithmetic. I have submitted a pull request fixing this.
Comment #1 by github-bugzilla — 2012-09-28T06:40:48Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/d94803416b683e4aa693c92133c258e8cfc730d6 Merge pull request #805 from callumenator/master Fix for issue 8689, Variant doesn't attempt float conversion in opArithmetic
Comment #2 by yebblies — 2013-01-02T00:28:32Z
Seems to be fixed in 2.061