[Swift-user] floor(), ceil() and round() issues with v0.8.0

Tim Armstrong tim.g.armstrong at gmail.com
Sun Jul 26 18:18:03 CDT 2015


Hi Tim,
  The return type of those functions changed to float in 0.8.0 as part of a
bigger effort to standardise the Swift library.  We tried to keep things
backwards compatible as much as possible but unfortunately there wasn't a
way to do that in this case.

You can get the same effect with toInt(floor(7.8))

- Tim

On 26 July 2015 at 12:59, Timothy Stitt (TGAC) <Timothy.Stitt at tgac.ac.uk>
wrote:

>  Dear Swift/T developers & users,
>
>  I've been recompiling a Swift/T script in v0.8.0 (which worked in
> previous versions) but its failing to compile at the line involving the
> floor() command. The error I'm seeing is:
>
>  stc error:
> test.swift:7:6: Cannot assign to t: LVal has type int but RVal has type
> float
>
>  I know that this worked fine in previous versions so I tried to compile
> with the trivial example below and I get the same error:
>
>  import math;
> import io;
> import sys;
>
>  main
> {
>  int t = floor(7.8);
>  trace(t);
> }
>
>  I substituted floor() for ceil() and round() and got the same error. Is
> there something wrong with the math library or am I doing something really
> stupid that I can't see.
>
>  Thanks,
>
>  Tim.
>
> ---
>
> *Timothy Stitt PhD* / Head of Scientific Computing
>
> The Genome Analysis Centre (TGAC), Room 204b
>
> http://www.tgac.ac.uk/
>
>
>  p: +44 1603 450378
>
> e: timothy.stitt at tgac.ac.uk
>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20150726/83d529a9/attachment.html>


More information about the Swift-user mailing list