]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/issue-27859.rs
New upstream version 1.29.0+dfsg1
[rustc.git] / src / test / run-pass / issue-27859.rs
CommitLineData
1a4d82fc 1// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
223e47cc
LB
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
2c00a5a8 11// ignore-cloudabi no std::env
041b39d2
XL
12// ignore-wasm32 issue 42629
13
e9174d1e
SL
14#[inline(never)]
15fn foo(a: f32, b: f32) -> f32 {
16 a % b
17}
62682a34 18
e9174d1e
SL
19#[inline(never)]
20fn bar(a: f32, b: f32) -> f32 {
21 ((a as f64) % (b as f64)) as f32
62682a34
SL
22}
23
24fn main() {
e9174d1e
SL
25 let unknown_float = std::env::args().len();
26 println!("{}", foo(4.0, unknown_float as f32));
27 println!("{}", foo(5.0, (unknown_float as f32) + 1.0));
28 println!("{}", bar(6.0, (unknown_float as f32) + 2.0));
29 println!("{}", bar(7.0, (unknown_float as f32) + 3.0));
62682a34 30}