Data Type Conversion Help - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10) +---- Thread: Data Type Conversion Help (/showthread.php?tid=312) |
Data Type Conversion Help - TarotRedhand - 05-02-2022 Simply put how do I convert the type of the result of the operation in the () from LONG to DOUBLE in the snippet below? Code: (Select All) Answer# = 1.0 + (ARowEnd& - ARowStart&) Thanks TR RE: Data Type Conversion Help - bplus - 05-02-2022 I'm not sure you have to do anything other than use the suffix for the variable container. If pressed this might work: Answer# = Val(Str$(1 + (ARowEnd& - ARowStart&))) Print Answer# RE: Data Type Conversion Help - Jack - 05-02-2022 I would have used cdbl(ARowEnd& - ARowStart&) RE: Data Type Conversion Help - RhoSigma - 05-02-2022 (05-02-2022, 08:26 PM)TarotRedhand Wrote: Simply put how do I convert the type of the result of the operation in the () from LONG to DOUBLE in the snippet below? Just use that line of code as is, you already specified Answer as DOUBLE using the # suffix, whatever the type of 1.0 + (ARowEnd& - ARowStart&) will evaluate to (probably SINGLE) will be automatically converted under the hood to mach your specified Answer# type. RE: Data Type Conversion Help - TarotRedhand - 05-03-2022 Thanks Guys. Looks like the 2622 line (includes comments) library of mine should be good to go. TR |