www.digitalmars.com         C & C++   DMDScript  

D - numeric literals

reply "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> writes:
Hi,

    I'm not finding in the documentation the correct syntax to write the
ifloat/cfloat literals. Also the compiler (dmd 0.59) keeps saying "toelem:
cannot cast from idouble to ifloat" even if I put explicit casts in it:
"ifloat f = cast(ifloat) 0i;". BTW what's the correct way to write numeric
literals of all kinds? I'm having some trouble with properties of
floating-point types (e.g. isnan or isinfinite). Are they implemented?
    It's late and I'm falling on the keyboard, maybe I'm just need some
sleep ;-)

    Best regards,
    Daniel Yokomiso.

"There are 10 kinds of people: those who understand binary and those who
don't."



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/3/2003
Mar 20 2003
next sibling parent "John Reimer" <jjreimer telus.net> writes:
"Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message
news:b5drq4$2g26$1 digitaldaemon.com...
 Hi,

     I'm not finding in the documentation the correct syntax to write the
 ifloat/cfloat literals. Also the compiler (dmd 0.59) keeps saying "toelem:
 cannot cast from idouble to ifloat" even if I put explicit casts in it:
 "ifloat f = cast(ifloat) 0i;". BTW what's the correct way to write numeric
 literals of all kinds? I'm having some trouble with properties of
 floating-point types (e.g. isnan or isinfinite). Are they implemented?
     It's late and I'm falling on the keyboard, maybe I'm just need some
 sleep ;-)
I asked a similar question earlier and got no answer. My question was about what consititued a legal complex expression. At that time, I also was attempting to use imaginary literals within a complex expression. The compiler either would bulk or compile away depending on which way I tried getting around the problem. If it did compile, my program ended up spitting out incorrect results. Casting didn't work for me either. So I don't know, maybe someone else can offer a suggestion... But the way complex numbers are now, I can't use them in D because they don't really work correctly. Oh well. All I can say is... I know what you're saying... :-P Later, John
Mar 20 2003
prev sibling parent "Walter" <walter digitalmars.com> writes:
"Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message
news:b5drq4$2g26$1 digitaldaemon.com...
     I'm not finding in the documentation the correct syntax to write the
 ifloat/cfloat literals. Also the compiler (dmd 0.59) keeps saying "toelem:
 cannot cast from idouble to ifloat" even if I put explicit casts in it:
 "ifloat f = cast(ifloat) 0i;".
I need to fix that.
 BTW what's the correct way to write numeric
 literals of all kinds? I'm having some trouble with properties of
 floating-point types (e.g. isnan or isinfinite). Are they implemented?
math.isnan is implemented, so is math.isinf. isinfinite isn't.
Mar 21 2003