]>
git.proxmox.com Git - rustc.git/blob - src/etc/test-float-parse/_common.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
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.
12 use std
::io
::prelude
::*;
13 use std
::mem
::transmute
;
15 // Nothing up my sleeve: Just (PI - 3) in base 16.
17 pub const SEED
: [u32; 3] = [0x243f_6a88, 0x85a3_08d3, 0x1319_8a2e];
19 pub fn validate(text
: String
) {
20 let mut out
= io
::stdout();
21 let x
: f64 = text
.parse().unwrap();
22 let f64_bytes
: u64 = unsafe { transmute(x) }
;
23 let x
: f32 = text
.parse().unwrap();
24 let f32_bytes
: u32 = unsafe { transmute(x) }
;
25 writeln
!(&mut out
, "{:016x} {:08x} {}", f64_bytes
, f32_bytes
, text
).unwrap();