| 1 |
/* Copyright 2021 Mozilla Foundation |
| 2 |
* |
| 3 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
* you may not use this file except in compliance with the License. |
| 5 |
* You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software |
| 10 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
* See the License for the specific language governing permissions and |
| 13 |
* limitations under the License. |
| 14 |
*/ |
| 15 |
|
| 16 |
// ./test/core/float_literals.wast |
| 17 |
|
| 18 |
// ./test/core/float_literals.wast:3 |
| 19 |
let $0 = instantiate(`(module |
| 20 |
;; f32 special values |
| 21 |
(func (export "f32.nan") (result i32) (i32.reinterpret_f32 (f32.const nan))) |
| 22 |
(func (export "f32.positive_nan") (result i32) (i32.reinterpret_f32 (f32.const +nan))) |
| 23 |
(func (export "f32.negative_nan") (result i32) (i32.reinterpret_f32 (f32.const -nan))) |
| 24 |
(func (export "f32.plain_nan") (result i32) (i32.reinterpret_f32 (f32.const nan:0x400000))) |
| 25 |
(func (export "f32.informally_known_as_plain_snan") (result i32) (i32.reinterpret_f32 (f32.const nan:0x200000))) |
| 26 |
(func (export "f32.all_ones_nan") (result i32) (i32.reinterpret_f32 (f32.const -nan:0x7fffff))) |
| 27 |
(func (export "f32.misc_nan") (result i32) (i32.reinterpret_f32 (f32.const nan:0x012345))) |
| 28 |
(func (export "f32.misc_positive_nan") (result i32) (i32.reinterpret_f32 (f32.const +nan:0x304050))) |
| 29 |
(func (export "f32.misc_negative_nan") (result i32) (i32.reinterpret_f32 (f32.const -nan:0x2abcde))) |
| 30 |
(func (export "f32.infinity") (result i32) (i32.reinterpret_f32 (f32.const inf))) |
| 31 |
(func (export "f32.positive_infinity") (result i32) (i32.reinterpret_f32 (f32.const +inf))) |
| 32 |
(func (export "f32.negative_infinity") (result i32) (i32.reinterpret_f32 (f32.const -inf))) |
| 33 |
|
| 34 |
;; f32 numbers |
| 35 |
(func (export "f32.zero") (result i32) (i32.reinterpret_f32 (f32.const 0x0.0p0))) |
| 36 |
(func (export "f32.positive_zero") (result i32) (i32.reinterpret_f32 (f32.const +0x0.0p0))) |
| 37 |
(func (export "f32.negative_zero") (result i32) (i32.reinterpret_f32 (f32.const -0x0.0p0))) |
| 38 |
(func (export "f32.misc") (result i32) (i32.reinterpret_f32 (f32.const 0x1.921fb6p+2))) |
| 39 |
(func (export "f32.min_positive") (result i32) (i32.reinterpret_f32 (f32.const 0x1p-149))) |
| 40 |
(func (export "f32.min_normal") (result i32) (i32.reinterpret_f32 (f32.const 0x1p-126))) |
| 41 |
(func (export "f32.max_finite") (result i32) (i32.reinterpret_f32 (f32.const 0x1.fffffep+127))) |
| 42 |
(func (export "f32.max_subnormal") (result i32) (i32.reinterpret_f32 (f32.const 0x1.fffffcp-127))) |
| 43 |
(func (export "f32.trailing_dot") (result i32) (i32.reinterpret_f32 (f32.const 0x1.p10))) |
| 44 |
|
| 45 |
;; f32 in decimal format |
| 46 |
(func (export "f32_dec.zero") (result i32) (i32.reinterpret_f32 (f32.const 0.0e0))) |
| 47 |
(func (export "f32_dec.positive_zero") (result i32) (i32.reinterpret_f32 (f32.const +0.0e0))) |
| 48 |
(func (export "f32_dec.negative_zero") (result i32) (i32.reinterpret_f32 (f32.const -0.0e0))) |
| 49 |
(func (export "f32_dec.misc") (result i32) (i32.reinterpret_f32 (f32.const 6.28318548202514648))) |
| 50 |
(func (export "f32_dec.min_positive") (result i32) (i32.reinterpret_f32 (f32.const 1.4013e-45))) |
| 51 |
(func (export "f32_dec.min_normal") (result i32) (i32.reinterpret_f32 (f32.const 1.1754944e-38))) |
| 52 |
(func (export "f32_dec.max_subnormal") (result i32) (i32.reinterpret_f32 (f32.const 1.1754942e-38))) |
| 53 |
(func (export "f32_dec.max_finite") (result i32) (i32.reinterpret_f32 (f32.const 3.4028234e+38))) |
| 54 |
(func (export "f32_dec.trailing_dot") (result i32) (i32.reinterpret_f32 (f32.const 1.e10))) |
| 55 |
|
| 56 |
;; https://twitter.com/Archivd/status/994637336506912768 |
| 57 |
(func (export "f32_dec.root_beer_float") (result i32) (i32.reinterpret_f32 (f32.const 1.000000119))) |
| 58 |
|
| 59 |
;; f64 special values |
| 60 |
(func (export "f64.nan") (result i64) (i64.reinterpret_f64 (f64.const nan))) |
| 61 |
(func (export "f64.positive_nan") (result i64) (i64.reinterpret_f64 (f64.const +nan))) |
| 62 |
(func (export "f64.negative_nan") (result i64) (i64.reinterpret_f64 (f64.const -nan))) |
| 63 |
(func (export "f64.plain_nan") (result i64) (i64.reinterpret_f64 (f64.const nan:0x8000000000000))) |
| 64 |
(func (export "f64.informally_known_as_plain_snan") (result i64) (i64.reinterpret_f64 (f64.const nan:0x4000000000000))) |
| 65 |
(func (export "f64.all_ones_nan") (result i64) (i64.reinterpret_f64 (f64.const -nan:0xfffffffffffff))) |
| 66 |
(func (export "f64.misc_nan") (result i64) (i64.reinterpret_f64 (f64.const nan:0x0123456789abc))) |
| 67 |
(func (export "f64.misc_positive_nan") (result i64) (i64.reinterpret_f64 (f64.const +nan:0x3040506070809))) |
| 68 |
(func (export "f64.misc_negative_nan") (result i64) (i64.reinterpret_f64 (f64.const -nan:0x2abcdef012345))) |
| 69 |
(func (export "f64.infinity") (result i64) (i64.reinterpret_f64 (f64.const inf))) |
| 70 |
(func (export "f64.positive_infinity") (result i64) (i64.reinterpret_f64 (f64.const +inf))) |
| 71 |
(func (export "f64.negative_infinity") (result i64) (i64.reinterpret_f64 (f64.const -inf))) |
| 72 |
|
| 73 |
;; f64 numbers |
| 74 |
(func (export "f64.zero") (result i64) (i64.reinterpret_f64 (f64.const 0x0.0p0))) |
| 75 |
(func (export "f64.positive_zero") (result i64) (i64.reinterpret_f64 (f64.const +0x0.0p0))) |
| 76 |
(func (export "f64.negative_zero") (result i64) (i64.reinterpret_f64 (f64.const -0x0.0p0))) |
| 77 |
(func (export "f64.misc") (result i64) (i64.reinterpret_f64 (f64.const 0x1.921fb54442d18p+2))) |
| 78 |
(func (export "f64.min_positive") (result i64) (i64.reinterpret_f64 (f64.const 0x0.0000000000001p-1022))) |
| 79 |
(func (export "f64.min_normal") (result i64) (i64.reinterpret_f64 (f64.const 0x1p-1022))) |
| 80 |
(func (export "f64.max_subnormal") (result i64) (i64.reinterpret_f64 (f64.const 0x0.fffffffffffffp-1022))) |
| 81 |
(func (export "f64.max_finite") (result i64) (i64.reinterpret_f64 (f64.const 0x1.fffffffffffffp+1023))) |
| 82 |
(func (export "f64.trailing_dot") (result i64) (i64.reinterpret_f64 (f64.const 0x1.p100))) |
| 83 |
|
| 84 |
;; f64 numbers in decimal format |
| 85 |
(func (export "f64_dec.zero") (result i64) (i64.reinterpret_f64 (f64.const 0.0e0))) |
| 86 |
(func (export "f64_dec.positive_zero") (result i64) (i64.reinterpret_f64 (f64.const +0.0e0))) |
| 87 |
(func (export "f64_dec.negative_zero") (result i64) (i64.reinterpret_f64 (f64.const -0.0e0))) |
| 88 |
(func (export "f64_dec.misc") (result i64) (i64.reinterpret_f64 (f64.const 6.28318530717958623))) |
| 89 |
(func (export "f64_dec.min_positive") (result i64) (i64.reinterpret_f64 (f64.const 4.94066e-324))) |
| 90 |
(func (export "f64_dec.min_normal") (result i64) (i64.reinterpret_f64 (f64.const 2.2250738585072012e-308))) |
| 91 |
(func (export "f64_dec.max_subnormal") (result i64) (i64.reinterpret_f64 (f64.const 2.2250738585072011e-308))) |
| 92 |
(func (export "f64_dec.max_finite") (result i64) (i64.reinterpret_f64 (f64.const 1.7976931348623157e+308))) |
| 93 |
(func (export "f64_dec.trailing_dot") (result i64) (i64.reinterpret_f64 (f64.const 1.e100))) |
| 94 |
|
| 95 |
;; https://twitter.com/Archivd/status/994637336506912768 |
| 96 |
(func (export "f64_dec.root_beer_float") (result i64) (i64.reinterpret_f64 (f64.const 1.000000119))) |
| 97 |
|
| 98 |
(func (export "f32-dec-sep1") (result f32) (f32.const 1_000_000)) |
| 99 |
(func (export "f32-dec-sep2") (result f32) (f32.const 1_0_0_0)) |
| 100 |
(func (export "f32-dec-sep3") (result f32) (f32.const 100_3.141_592)) |
| 101 |
(func (export "f32-dec-sep4") (result f32) (f32.const 99e+1_3)) |
| 102 |
(func (export "f32-dec-sep5") (result f32) (f32.const 122_000.11_3_54E0_2_3)) |
| 103 |
(func (export "f32-hex-sep1") (result f32) (f32.const 0xa_0f_00_99)) |
| 104 |
(func (export "f32-hex-sep2") (result f32) (f32.const 0x1_a_A_0_f)) |
| 105 |
(func (export "f32-hex-sep3") (result f32) (f32.const 0xa0_ff.f141_a59a)) |
| 106 |
(func (export "f32-hex-sep4") (result f32) (f32.const 0xf0P+1_3)) |
| 107 |
(func (export "f32-hex-sep5") (result f32) (f32.const 0x2a_f00a.1f_3_eep2_3)) |
| 108 |
|
| 109 |
(func (export "f64-dec-sep1") (result f64) (f64.const 1_000_000)) |
| 110 |
(func (export "f64-dec-sep2") (result f64) (f64.const 1_0_0_0)) |
| 111 |
(func (export "f64-dec-sep3") (result f64) (f64.const 100_3.141_592)) |
| 112 |
(func (export "f64-dec-sep4") (result f64) (f64.const 99e-1_23)) |
| 113 |
(func (export "f64-dec-sep5") (result f64) (f64.const 122_000.11_3_54e0_2_3)) |
| 114 |
(func (export "f64-hex-sep1") (result f64) (f64.const 0xa_f00f_0000_9999)) |
| 115 |
(func (export "f64-hex-sep2") (result f64) (f64.const 0x1_a_A_0_f)) |
| 116 |
(func (export "f64-hex-sep3") (result f64) (f64.const 0xa0_ff.f141_a59a)) |
| 117 |
(func (export "f64-hex-sep4") (result f64) (f64.const 0xf0P+1_3)) |
| 118 |
(func (export "f64-hex-sep5") (result f64) (f64.const 0x2a_f00a.1f_3_eep2_3)) |
| 119 |
)`); |
| 120 |
|
| 121 |
// ./test/core/float_literals.wast:105 |
| 122 |
assert_return(() => invoke($0, `f32.nan`, []), [value("i32", 2143289344)]); |
| 123 |
|
| 124 |
// ./test/core/float_literals.wast:106 |
| 125 |
assert_return(() => invoke($0, `f32.positive_nan`, []), [value("i32", 2143289344)]); |
| 126 |
|
| 127 |
// ./test/core/float_literals.wast:107 |
| 128 |
assert_return(() => invoke($0, `f32.negative_nan`, []), [value("i32", -4194304)]); |
| 129 |
|
| 130 |
// ./test/core/float_literals.wast:108 |
| 131 |
assert_return(() => invoke($0, `f32.plain_nan`, []), [value("i32", 2143289344)]); |
| 132 |
|
| 133 |
// ./test/core/float_literals.wast:109 |
| 134 |
assert_return(() => invoke($0, `f32.informally_known_as_plain_snan`, []), [value("i32", 2141192192)]); |
| 135 |
|
| 136 |
// ./test/core/float_literals.wast:110 |
| 137 |
assert_return(() => invoke($0, `f32.all_ones_nan`, []), [value("i32", -1)]); |
| 138 |
|
| 139 |
// ./test/core/float_literals.wast:111 |
| 140 |
assert_return(() => invoke($0, `f32.misc_nan`, []), [value("i32", 2139169605)]); |
| 141 |
|
| 142 |
// ./test/core/float_literals.wast:112 |
| 143 |
assert_return(() => invoke($0, `f32.misc_positive_nan`, []), [value("i32", 2142257232)]); |
| 144 |
|
| 145 |
// ./test/core/float_literals.wast:113 |
| 146 |
assert_return(() => invoke($0, `f32.misc_negative_nan`, []), [value("i32", -5587746)]); |
| 147 |
|
| 148 |
// ./test/core/float_literals.wast:114 |
| 149 |
assert_return(() => invoke($0, `f32.infinity`, []), [value("i32", 2139095040)]); |
| 150 |
|
| 151 |
// ./test/core/float_literals.wast:115 |
| 152 |
assert_return(() => invoke($0, `f32.positive_infinity`, []), [value("i32", 2139095040)]); |
| 153 |
|
| 154 |
// ./test/core/float_literals.wast:116 |
| 155 |
assert_return(() => invoke($0, `f32.negative_infinity`, []), [value("i32", -8388608)]); |
| 156 |
|
| 157 |
// ./test/core/float_literals.wast:117 |
| 158 |
assert_return(() => invoke($0, `f32.zero`, []), [value("i32", 0)]); |
| 159 |
|
| 160 |
// ./test/core/float_literals.wast:118 |
| 161 |
assert_return(() => invoke($0, `f32.positive_zero`, []), [value("i32", 0)]); |
| 162 |
|
| 163 |
// ./test/core/float_literals.wast:119 |
| 164 |
assert_return(() => invoke($0, `f32.negative_zero`, []), [value("i32", -2147483648)]); |
| 165 |
|
| 166 |
// ./test/core/float_literals.wast:120 |
| 167 |
assert_return(() => invoke($0, `f32.misc`, []), [value("i32", 1086918619)]); |
| 168 |
|
| 169 |
// ./test/core/float_literals.wast:121 |
| 170 |
assert_return(() => invoke($0, `f32.min_positive`, []), [value("i32", 1)]); |
| 171 |
|
| 172 |
// ./test/core/float_literals.wast:122 |
| 173 |
assert_return(() => invoke($0, `f32.min_normal`, []), [value("i32", 8388608)]); |
| 174 |
|
| 175 |
// ./test/core/float_literals.wast:123 |
| 176 |
assert_return(() => invoke($0, `f32.max_subnormal`, []), [value("i32", 8388607)]); |
| 177 |
|
| 178 |
// ./test/core/float_literals.wast:124 |
| 179 |
assert_return(() => invoke($0, `f32.max_finite`, []), [value("i32", 2139095039)]); |
| 180 |
|
| 181 |
// ./test/core/float_literals.wast:125 |
| 182 |
assert_return(() => invoke($0, `f32.trailing_dot`, []), [value("i32", 1149239296)]); |
| 183 |
|
| 184 |
// ./test/core/float_literals.wast:126 |
| 185 |
assert_return(() => invoke($0, `f32_dec.zero`, []), [value("i32", 0)]); |
| 186 |
|
| 187 |
// ./test/core/float_literals.wast:127 |
| 188 |
assert_return(() => invoke($0, `f32_dec.positive_zero`, []), [value("i32", 0)]); |
| 189 |
|
| 190 |
// ./test/core/float_literals.wast:128 |
| 191 |
assert_return(() => invoke($0, `f32_dec.negative_zero`, []), [value("i32", -2147483648)]); |
| 192 |
|
| 193 |
// ./test/core/float_literals.wast:129 |
| 194 |
assert_return(() => invoke($0, `f32_dec.misc`, []), [value("i32", 1086918619)]); |
| 195 |
|
| 196 |
// ./test/core/float_literals.wast:130 |
| 197 |
assert_return(() => invoke($0, `f32_dec.min_positive`, []), [value("i32", 1)]); |
| 198 |
|
| 199 |
// ./test/core/float_literals.wast:131 |
| 200 |
assert_return(() => invoke($0, `f32_dec.min_normal`, []), [value("i32", 8388608)]); |
| 201 |
|
| 202 |
// ./test/core/float_literals.wast:132 |
| 203 |
assert_return(() => invoke($0, `f32_dec.max_subnormal`, []), [value("i32", 8388607)]); |
| 204 |
|
| 205 |
// ./test/core/float_literals.wast:133 |
| 206 |
assert_return(() => invoke($0, `f32_dec.max_finite`, []), [value("i32", 2139095039)]); |
| 207 |
|
| 208 |
// ./test/core/float_literals.wast:134 |
| 209 |
assert_return(() => invoke($0, `f32_dec.trailing_dot`, []), [value("i32", 1343554297)]); |
| 210 |
|
| 211 |
// ./test/core/float_literals.wast:135 |
| 212 |
assert_return(() => invoke($0, `f32_dec.root_beer_float`, []), [value("i32", 1065353217)]); |
| 213 |
|
| 214 |
// ./test/core/float_literals.wast:137 |
| 215 |
assert_return(() => invoke($0, `f64.nan`, []), [value("i64", 9221120237041090560n)]); |
| 216 |
|
| 217 |
// ./test/core/float_literals.wast:138 |
| 218 |
assert_return(() => invoke($0, `f64.positive_nan`, []), [value("i64", 9221120237041090560n)]); |
| 219 |
|
| 220 |
// ./test/core/float_literals.wast:139 |
| 221 |
assert_return(() => invoke($0, `f64.negative_nan`, []), [value("i64", -2251799813685248n)]); |
| 222 |
|
| 223 |
// ./test/core/float_literals.wast:140 |
| 224 |
assert_return(() => invoke($0, `f64.plain_nan`, []), [value("i64", 9221120237041090560n)]); |
| 225 |
|
| 226 |
// ./test/core/float_literals.wast:141 |
| 227 |
assert_return( |
| 228 |
() => invoke($0, `f64.informally_known_as_plain_snan`, []), |
| 229 |
[value("i64", 9219994337134247936n)], |
| 230 |
); |
| 231 |
|
| 232 |
// ./test/core/float_literals.wast:142 |
| 233 |
assert_return(() => invoke($0, `f64.all_ones_nan`, []), [value("i64", -1n)]); |
| 234 |
|
| 235 |
// ./test/core/float_literals.wast:143 |
| 236 |
assert_return(() => invoke($0, `f64.misc_nan`, []), [value("i64", 9218888453225749180n)]); |
| 237 |
|
| 238 |
// ./test/core/float_literals.wast:144 |
| 239 |
assert_return(() => invoke($0, `f64.misc_positive_nan`, []), [value("i64", 9219717281780008969n)]); |
| 240 |
|
| 241 |
// ./test/core/float_literals.wast:145 |
| 242 |
assert_return(() => invoke($0, `f64.misc_negative_nan`, []), [value("i64", -3751748707474619n)]); |
| 243 |
|
| 244 |
// ./test/core/float_literals.wast:146 |
| 245 |
assert_return(() => invoke($0, `f64.infinity`, []), [value("i64", 9218868437227405312n)]); |
| 246 |
|
| 247 |
// ./test/core/float_literals.wast:147 |
| 248 |
assert_return(() => invoke($0, `f64.positive_infinity`, []), [value("i64", 9218868437227405312n)]); |
| 249 |
|
| 250 |
// ./test/core/float_literals.wast:148 |
| 251 |
assert_return(() => invoke($0, `f64.negative_infinity`, []), [value("i64", -4503599627370496n)]); |
| 252 |
|
| 253 |
// ./test/core/float_literals.wast:149 |
| 254 |
assert_return(() => invoke($0, `f64.zero`, []), [value("i64", 0n)]); |
| 255 |
|
| 256 |
// ./test/core/float_literals.wast:150 |
| 257 |
assert_return(() => invoke($0, `f64.positive_zero`, []), [value("i64", 0n)]); |
| 258 |
|
| 259 |
// ./test/core/float_literals.wast:151 |
| 260 |
assert_return(() => invoke($0, `f64.negative_zero`, []), [value("i64", -9223372036854775808n)]); |
| 261 |
|
| 262 |
// ./test/core/float_literals.wast:152 |
| 263 |
assert_return(() => invoke($0, `f64.misc`, []), [value("i64", 4618760256179416344n)]); |
| 264 |
|
| 265 |
// ./test/core/float_literals.wast:153 |
| 266 |
assert_return(() => invoke($0, `f64.min_positive`, []), [value("i64", 1n)]); |
| 267 |
|
| 268 |
// ./test/core/float_literals.wast:154 |
| 269 |
assert_return(() => invoke($0, `f64.min_normal`, []), [value("i64", 4503599627370496n)]); |
| 270 |
|
| 271 |
// ./test/core/float_literals.wast:155 |
| 272 |
assert_return(() => invoke($0, `f64.max_subnormal`, []), [value("i64", 4503599627370495n)]); |
| 273 |
|
| 274 |
// ./test/core/float_literals.wast:156 |
| 275 |
assert_return(() => invoke($0, `f64.max_finite`, []), [value("i64", 9218868437227405311n)]); |
| 276 |
|
| 277 |
// ./test/core/float_literals.wast:157 |
| 278 |
assert_return(() => invoke($0, `f64.trailing_dot`, []), [value("i64", 5057542381537067008n)]); |
| 279 |
|
| 280 |
// ./test/core/float_literals.wast:158 |
| 281 |
assert_return(() => invoke($0, `f64_dec.zero`, []), [value("i64", 0n)]); |
| 282 |
|
| 283 |
// ./test/core/float_literals.wast:159 |
| 284 |
assert_return(() => invoke($0, `f64_dec.positive_zero`, []), [value("i64", 0n)]); |
| 285 |
|
| 286 |
// ./test/core/float_literals.wast:160 |
| 287 |
assert_return(() => invoke($0, `f64_dec.negative_zero`, []), [value("i64", -9223372036854775808n)]); |
| 288 |
|
| 289 |
// ./test/core/float_literals.wast:161 |
| 290 |
assert_return(() => invoke($0, `f64_dec.misc`, []), [value("i64", 4618760256179416344n)]); |
| 291 |
|
| 292 |
// ./test/core/float_literals.wast:162 |
| 293 |
assert_return(() => invoke($0, `f64_dec.min_positive`, []), [value("i64", 1n)]); |
| 294 |
|
| 295 |
// ./test/core/float_literals.wast:163 |
| 296 |
assert_return(() => invoke($0, `f64_dec.min_normal`, []), [value("i64", 4503599627370496n)]); |
| 297 |
|
| 298 |
// ./test/core/float_literals.wast:164 |
| 299 |
assert_return(() => invoke($0, `f64_dec.max_subnormal`, []), [value("i64", 4503599627370495n)]); |
| 300 |
|
| 301 |
// ./test/core/float_literals.wast:165 |
| 302 |
assert_return(() => invoke($0, `f64_dec.max_finite`, []), [value("i64", 9218868437227405311n)]); |
| 303 |
|
| 304 |
// ./test/core/float_literals.wast:166 |
| 305 |
assert_return(() => invoke($0, `f64_dec.trailing_dot`, []), [value("i64", 6103021453049119613n)]); |
| 306 |
|
| 307 |
// ./test/core/float_literals.wast:167 |
| 308 |
assert_return(() => invoke($0, `f64_dec.root_beer_float`, []), [value("i64", 4607182419335945764n)]); |
| 309 |
|
| 310 |
// ./test/core/float_literals.wast:169 |
| 311 |
assert_return(() => invoke($0, `f32-dec-sep1`, []), [value("f32", 1000000)]); |
| 312 |
|
| 313 |
// ./test/core/float_literals.wast:170 |
| 314 |
assert_return(() => invoke($0, `f32-dec-sep2`, []), [value("f32", 1000)]); |
| 315 |
|
| 316 |
// ./test/core/float_literals.wast:171 |
| 317 |
assert_return(() => invoke($0, `f32-dec-sep3`, []), [value("f32", 1003.1416)]); |
| 318 |
|
| 319 |
// ./test/core/float_literals.wast:172 |
| 320 |
assert_return(() => invoke($0, `f32-dec-sep4`, []), [value("f32", 990000000000000)]); |
| 321 |
|
| 322 |
// ./test/core/float_literals.wast:173 |
| 323 |
assert_return(() => invoke($0, `f32-dec-sep5`, []), [value("f32", 12200012000000000000000000000)]); |
| 324 |
|
| 325 |
// ./test/core/float_literals.wast:174 |
| 326 |
assert_return(() => invoke($0, `f32-hex-sep1`, []), [value("f32", 168755360)]); |
| 327 |
|
| 328 |
// ./test/core/float_literals.wast:175 |
| 329 |
assert_return(() => invoke($0, `f32-hex-sep2`, []), [value("f32", 109071)]); |
| 330 |
|
| 331 |
// ./test/core/float_literals.wast:176 |
| 332 |
assert_return(() => invoke($0, `f32-hex-sep3`, []), [value("f32", 41215.94)]); |
| 333 |
|
| 334 |
// ./test/core/float_literals.wast:177 |
| 335 |
assert_return(() => invoke($0, `f32-hex-sep4`, []), [value("f32", 1966080)]); |
| 336 |
|
| 337 |
// ./test/core/float_literals.wast:178 |
| 338 |
assert_return(() => invoke($0, `f32-hex-sep5`, []), [value("f32", 23605224000000)]); |
| 339 |
|
| 340 |
// ./test/core/float_literals.wast:180 |
| 341 |
assert_return(() => invoke($0, `f64-dec-sep1`, []), [value("f64", 1000000)]); |
| 342 |
|
| 343 |
// ./test/core/float_literals.wast:181 |
| 344 |
assert_return(() => invoke($0, `f64-dec-sep2`, []), [value("f64", 1000)]); |
| 345 |
|
| 346 |
// ./test/core/float_literals.wast:182 |
| 347 |
assert_return(() => invoke($0, `f64-dec-sep3`, []), [value("f64", 1003.141592)]); |
| 348 |
|
| 349 |
// ./test/core/float_literals.wast:183 |
| 350 |
assert_return( |
| 351 |
() => invoke($0, `f64-dec-sep4`, []), |
| 352 |
[ |
| 353 |
value("f64", 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099), |
| 354 |
], |
| 355 |
); |
| 356 |
|
| 357 |
// ./test/core/float_literals.wast:184 |
| 358 |
assert_return(() => invoke($0, `f64-dec-sep5`, []), [value("f64", 12200011354000000000000000000)]); |
| 359 |
|
| 360 |
// ./test/core/float_literals.wast:185 |
| 361 |
assert_return(() => invoke($0, `f64-hex-sep1`, []), [value("f64", 3078696982321561)]); |
| 362 |
|
| 363 |
// ./test/core/float_literals.wast:186 |
| 364 |
assert_return(() => invoke($0, `f64-hex-sep2`, []), [value("f64", 109071)]); |
| 365 |
|
| 366 |
// ./test/core/float_literals.wast:187 |
| 367 |
assert_return(() => invoke($0, `f64-hex-sep3`, []), [value("f64", 41215.94240794191)]); |
| 368 |
|
| 369 |
// ./test/core/float_literals.wast:188 |
| 370 |
assert_return(() => invoke($0, `f64-hex-sep4`, []), [value("f64", 1966080)]); |
| 371 |
|
| 372 |
// ./test/core/float_literals.wast:189 |
| 373 |
assert_return(() => invoke($0, `f64-hex-sep5`, []), [value("f64", 23605225168752)]); |
| 374 |
|
| 375 |
// ./test/core/float_literals.wast:192 |
| 376 |
let $1 = instantiate(`(module binary |
| 377 |
;; (func (export "4294967249") (result f64) (f64.const 4294967249)) |
| 378 |
"\\00\\61\\73\\6d\\01\\00\\00\\00\\01\\85\\80\\80\\80\\00\\01\\60" |
| 379 |
"\\00\\01\\7c\\03\\82\\80\\80\\80\\00\\01\\00\\07\\8e\\80\\80\\80" |
| 380 |
"\\00\\01\\0a\\34\\32\\39\\34\\39\\36\\37\\32\\34\\39\\00\\00\\0a" |
| 381 |
"\\91\\80\\80\\80\\00\\01\\8b\\80\\80\\80\\00\\00\\44\\00\\00\\20" |
| 382 |
"\\fa\\ff\\ff\\ef\\41\\0b" |
| 383 |
)`); |
| 384 |
|
| 385 |
// ./test/core/float_literals.wast:201 |
| 386 |
assert_return(() => invoke($1, `4294967249`, []), [value("f64", 4294967249)]); |
| 387 |
|
| 388 |
// ./test/core/float_literals.wast:203 |
| 389 |
assert_malformed(() => instantiate(`(global f32 (f32.const _100)) `), `unknown operator`); |
| 390 |
|
| 391 |
// ./test/core/float_literals.wast:207 |
| 392 |
assert_malformed(() => instantiate(`(global f32 (f32.const +_100)) `), `unknown operator`); |
| 393 |
|
| 394 |
// ./test/core/float_literals.wast:211 |
| 395 |
assert_malformed(() => instantiate(`(global f32 (f32.const -_100)) `), `unknown operator`); |
| 396 |
|
| 397 |
// ./test/core/float_literals.wast:215 |
| 398 |
assert_malformed(() => instantiate(`(global f32 (f32.const 99_)) `), `unknown operator`); |
| 399 |
|
| 400 |
// ./test/core/float_literals.wast:219 |
| 401 |
assert_malformed( |
| 402 |
() => instantiate(`(global f32 (f32.const 1__000)) `), |
| 403 |
`unknown operator`, |
| 404 |
); |
| 405 |
|
| 406 |
// ./test/core/float_literals.wast:223 |
| 407 |
assert_malformed(() => instantiate(`(global f32 (f32.const _1.0)) `), `unknown operator`); |
| 408 |
|
| 409 |
// ./test/core/float_literals.wast:227 |
| 410 |
assert_malformed(() => instantiate(`(global f32 (f32.const 1.0_)) `), `unknown operator`); |
| 411 |
|
| 412 |
// ./test/core/float_literals.wast:231 |
| 413 |
assert_malformed(() => instantiate(`(global f32 (f32.const 1_.0)) `), `unknown operator`); |
| 414 |
|
| 415 |
// ./test/core/float_literals.wast:235 |
| 416 |
assert_malformed(() => instantiate(`(global f32 (f32.const 1._0)) `), `unknown operator`); |
| 417 |
|
| 418 |
// ./test/core/float_literals.wast:239 |
| 419 |
assert_malformed(() => instantiate(`(global f32 (f32.const _1e1)) `), `unknown operator`); |
| 420 |
|
| 421 |
// ./test/core/float_literals.wast:243 |
| 422 |
assert_malformed(() => instantiate(`(global f32 (f32.const 1e1_)) `), `unknown operator`); |
| 423 |
|
| 424 |
// ./test/core/float_literals.wast:247 |
| 425 |
assert_malformed(() => instantiate(`(global f32 (f32.const 1_e1)) `), `unknown operator`); |
| 426 |
|
| 427 |
// ./test/core/float_literals.wast:251 |
| 428 |
assert_malformed(() => instantiate(`(global f32 (f32.const 1e_1)) `), `unknown operator`); |
| 429 |
|
| 430 |
// ./test/core/float_literals.wast:255 |
| 431 |
assert_malformed( |
| 432 |
() => instantiate(`(global f32 (f32.const _1.0e1)) `), |
| 433 |
`unknown operator`, |
| 434 |
); |
| 435 |
|
| 436 |
// ./test/core/float_literals.wast:259 |
| 437 |
assert_malformed( |
| 438 |
() => instantiate(`(global f32 (f32.const 1.0e1_)) `), |
| 439 |
`unknown operator`, |
| 440 |
); |
| 441 |
|
| 442 |
// ./test/core/float_literals.wast:263 |
| 443 |
assert_malformed( |
| 444 |
() => instantiate(`(global f32 (f32.const 1.0_e1)) `), |
| 445 |
`unknown operator`, |
| 446 |
); |
| 447 |
|
| 448 |
// ./test/core/float_literals.wast:267 |
| 449 |
assert_malformed( |
| 450 |
() => instantiate(`(global f32 (f32.const 1.0e_1)) `), |
| 451 |
`unknown operator`, |
| 452 |
); |
| 453 |
|
| 454 |
// ./test/core/float_literals.wast:271 |
| 455 |
assert_malformed( |
| 456 |
() => instantiate(`(global f32 (f32.const 1.0e+_1)) `), |
| 457 |
`unknown operator`, |
| 458 |
); |
| 459 |
|
| 460 |
// ./test/core/float_literals.wast:275 |
| 461 |
assert_malformed( |
| 462 |
() => instantiate(`(global f32 (f32.const 1.0e_+1)) `), |
| 463 |
`unknown operator`, |
| 464 |
); |
| 465 |
|
| 466 |
// ./test/core/float_literals.wast:279 |
| 467 |
assert_malformed( |
| 468 |
() => instantiate(`(global f32 (f32.const _0x100)) `), |
| 469 |
`unknown operator`, |
| 470 |
); |
| 471 |
|
| 472 |
// ./test/core/float_literals.wast:283 |
| 473 |
assert_malformed( |
| 474 |
() => instantiate(`(global f32 (f32.const 0_x100)) `), |
| 475 |
`unknown operator`, |
| 476 |
); |
| 477 |
|
| 478 |
// ./test/core/float_literals.wast:287 |
| 479 |
assert_malformed( |
| 480 |
() => instantiate(`(global f32 (f32.const 0x_100)) `), |
| 481 |
`unknown operator`, |
| 482 |
); |
| 483 |
|
| 484 |
// ./test/core/float_literals.wast:291 |
| 485 |
assert_malformed(() => instantiate(`(global f32 (f32.const 0x00_)) `), `unknown operator`); |
| 486 |
|
| 487 |
// ./test/core/float_literals.wast:295 |
| 488 |
assert_malformed( |
| 489 |
() => instantiate(`(global f32 (f32.const 0xff__ffff)) `), |
| 490 |
`unknown operator`, |
| 491 |
); |
| 492 |
|
| 493 |
// ./test/core/float_literals.wast:299 |
| 494 |
assert_malformed( |
| 495 |
() => instantiate(`(global f32 (f32.const 0x_1.0)) `), |
| 496 |
`unknown operator`, |
| 497 |
); |
| 498 |
|
| 499 |
// ./test/core/float_literals.wast:303 |
| 500 |
assert_malformed( |
| 501 |
() => instantiate(`(global f32 (f32.const 0x1.0_)) `), |
| 502 |
`unknown operator`, |
| 503 |
); |
| 504 |
|
| 505 |
// ./test/core/float_literals.wast:307 |
| 506 |
assert_malformed( |
| 507 |
() => instantiate(`(global f32 (f32.const 0x1_.0)) `), |
| 508 |
`unknown operator`, |
| 509 |
); |
| 510 |
|
| 511 |
// ./test/core/float_literals.wast:311 |
| 512 |
assert_malformed( |
| 513 |
() => instantiate(`(global f32 (f32.const 0x1._0)) `), |
| 514 |
`unknown operator`, |
| 515 |
); |
| 516 |
|
| 517 |
// ./test/core/float_literals.wast:315 |
| 518 |
assert_malformed( |
| 519 |
() => instantiate(`(global f32 (f32.const 0x_1p1)) `), |
| 520 |
`unknown operator`, |
| 521 |
); |
| 522 |
|
| 523 |
// ./test/core/float_literals.wast:319 |
| 524 |
assert_malformed( |
| 525 |
() => instantiate(`(global f32 (f32.const 0x1p1_)) `), |
| 526 |
`unknown operator`, |
| 527 |
); |
| 528 |
|
| 529 |
// ./test/core/float_literals.wast:323 |
| 530 |
assert_malformed( |
| 531 |
() => instantiate(`(global f32 (f32.const 0x1_p1)) `), |
| 532 |
`unknown operator`, |
| 533 |
); |
| 534 |
|
| 535 |
// ./test/core/float_literals.wast:327 |
| 536 |
assert_malformed( |
| 537 |
() => instantiate(`(global f32 (f32.const 0x1p_1)) `), |
| 538 |
`unknown operator`, |
| 539 |
); |
| 540 |
|
| 541 |
// ./test/core/float_literals.wast:331 |
| 542 |
assert_malformed( |
| 543 |
() => instantiate(`(global f32 (f32.const 0x_1.0p1)) `), |
| 544 |
`unknown operator`, |
| 545 |
); |
| 546 |
|
| 547 |
// ./test/core/float_literals.wast:335 |
| 548 |
assert_malformed( |
| 549 |
() => instantiate(`(global f32 (f32.const 0x1.0p1_)) `), |
| 550 |
`unknown operator`, |
| 551 |
); |
| 552 |
|
| 553 |
// ./test/core/float_literals.wast:339 |
| 554 |
assert_malformed( |
| 555 |
() => instantiate(`(global f32 (f32.const 0x1.0_p1)) `), |
| 556 |
`unknown operator`, |
| 557 |
); |
| 558 |
|
| 559 |
// ./test/core/float_literals.wast:343 |
| 560 |
assert_malformed( |
| 561 |
() => instantiate(`(global f32 (f32.const 0x1.0p_1)) `), |
| 562 |
`unknown operator`, |
| 563 |
); |
| 564 |
|
| 565 |
// ./test/core/float_literals.wast:347 |
| 566 |
assert_malformed( |
| 567 |
() => instantiate(`(global f32 (f32.const 0x1.0p+_1)) `), |
| 568 |
`unknown operator`, |
| 569 |
); |
| 570 |
|
| 571 |
// ./test/core/float_literals.wast:351 |
| 572 |
assert_malformed( |
| 573 |
() => instantiate(`(global f32 (f32.const 0x1.0p_+1)) `), |
| 574 |
`unknown operator`, |
| 575 |
); |
| 576 |
|
| 577 |
// ./test/core/float_literals.wast:356 |
| 578 |
assert_malformed(() => instantiate(`(global f64 (f64.const _100)) `), `unknown operator`); |
| 579 |
|
| 580 |
// ./test/core/float_literals.wast:360 |
| 581 |
assert_malformed(() => instantiate(`(global f64 (f64.const +_100)) `), `unknown operator`); |
| 582 |
|
| 583 |
// ./test/core/float_literals.wast:364 |
| 584 |
assert_malformed(() => instantiate(`(global f64 (f64.const -_100)) `), `unknown operator`); |
| 585 |
|
| 586 |
// ./test/core/float_literals.wast:368 |
| 587 |
assert_malformed(() => instantiate(`(global f64 (f64.const 99_)) `), `unknown operator`); |
| 588 |
|
| 589 |
// ./test/core/float_literals.wast:372 |
| 590 |
assert_malformed( |
| 591 |
() => instantiate(`(global f64 (f64.const 1__000)) `), |
| 592 |
`unknown operator`, |
| 593 |
); |
| 594 |
|
| 595 |
// ./test/core/float_literals.wast:376 |
| 596 |
assert_malformed(() => instantiate(`(global f64 (f64.const _1.0)) `), `unknown operator`); |
| 597 |
|
| 598 |
// ./test/core/float_literals.wast:380 |
| 599 |
assert_malformed(() => instantiate(`(global f64 (f64.const 1.0_)) `), `unknown operator`); |
| 600 |
|
| 601 |
// ./test/core/float_literals.wast:384 |
| 602 |
assert_malformed(() => instantiate(`(global f64 (f64.const 1_.0)) `), `unknown operator`); |
| 603 |
|
| 604 |
// ./test/core/float_literals.wast:388 |
| 605 |
assert_malformed(() => instantiate(`(global f64 (f64.const 1._0)) `), `unknown operator`); |
| 606 |
|
| 607 |
// ./test/core/float_literals.wast:392 |
| 608 |
assert_malformed(() => instantiate(`(global f64 (f64.const _1e1)) `), `unknown operator`); |
| 609 |
|
| 610 |
// ./test/core/float_literals.wast:396 |
| 611 |
assert_malformed(() => instantiate(`(global f64 (f64.const 1e1_)) `), `unknown operator`); |
| 612 |
|
| 613 |
// ./test/core/float_literals.wast:400 |
| 614 |
assert_malformed(() => instantiate(`(global f64 (f64.const 1_e1)) `), `unknown operator`); |
| 615 |
|
| 616 |
// ./test/core/float_literals.wast:404 |
| 617 |
assert_malformed(() => instantiate(`(global f64 (f64.const 1e_1)) `), `unknown operator`); |
| 618 |
|
| 619 |
// ./test/core/float_literals.wast:408 |
| 620 |
assert_malformed( |
| 621 |
() => instantiate(`(global f64 (f64.const _1.0e1)) `), |
| 622 |
`unknown operator`, |
| 623 |
); |
| 624 |
|
| 625 |
// ./test/core/float_literals.wast:412 |
| 626 |
assert_malformed( |
| 627 |
() => instantiate(`(global f64 (f64.const 1.0e1_)) `), |
| 628 |
`unknown operator`, |
| 629 |
); |
| 630 |
|
| 631 |
// ./test/core/float_literals.wast:416 |
| 632 |
assert_malformed( |
| 633 |
() => instantiate(`(global f64 (f64.const 1.0_e1)) `), |
| 634 |
`unknown operator`, |
| 635 |
); |
| 636 |
|
| 637 |
// ./test/core/float_literals.wast:420 |
| 638 |
assert_malformed( |
| 639 |
() => instantiate(`(global f64 (f64.const 1.0e_1)) `), |
| 640 |
`unknown operator`, |
| 641 |
); |
| 642 |
|
| 643 |
// ./test/core/float_literals.wast:424 |
| 644 |
assert_malformed( |
| 645 |
() => instantiate(`(global f64 (f64.const 1.0e+_1)) `), |
| 646 |
`unknown operator`, |
| 647 |
); |
| 648 |
|
| 649 |
// ./test/core/float_literals.wast:428 |
| 650 |
assert_malformed( |
| 651 |
() => instantiate(`(global f64 (f64.const 1.0e_+1)) `), |
| 652 |
`unknown operator`, |
| 653 |
); |
| 654 |
|
| 655 |
// ./test/core/float_literals.wast:432 |
| 656 |
assert_malformed( |
| 657 |
() => instantiate(`(global f64 (f64.const _0x100)) `), |
| 658 |
`unknown operator`, |
| 659 |
); |
| 660 |
|
| 661 |
// ./test/core/float_literals.wast:436 |
| 662 |
assert_malformed( |
| 663 |
() => instantiate(`(global f64 (f64.const 0_x100)) `), |
| 664 |
`unknown operator`, |
| 665 |
); |
| 666 |
|
| 667 |
// ./test/core/float_literals.wast:440 |
| 668 |
assert_malformed( |
| 669 |
() => instantiate(`(global f64 (f64.const 0x_100)) `), |
| 670 |
`unknown operator`, |
| 671 |
); |
| 672 |
|
| 673 |
// ./test/core/float_literals.wast:444 |
| 674 |
assert_malformed(() => instantiate(`(global f64 (f64.const 0x00_)) `), `unknown operator`); |
| 675 |
|
| 676 |
// ./test/core/float_literals.wast:448 |
| 677 |
assert_malformed( |
| 678 |
() => instantiate(`(global f64 (f64.const 0xff__ffff)) `), |
| 679 |
`unknown operator`, |
| 680 |
); |
| 681 |
|
| 682 |
// ./test/core/float_literals.wast:452 |
| 683 |
assert_malformed( |
| 684 |
() => instantiate(`(global f64 (f64.const 0x_1.0)) `), |
| 685 |
`unknown operator`, |
| 686 |
); |
| 687 |
|
| 688 |
// ./test/core/float_literals.wast:456 |
| 689 |
assert_malformed( |
| 690 |
() => instantiate(`(global f64 (f64.const 0x1.0_)) `), |
| 691 |
`unknown operator`, |
| 692 |
); |
| 693 |
|
| 694 |
// ./test/core/float_literals.wast:460 |
| 695 |
assert_malformed( |
| 696 |
() => instantiate(`(global f64 (f64.const 0x1_.0)) `), |
| 697 |
`unknown operator`, |
| 698 |
); |
| 699 |
|
| 700 |
// ./test/core/float_literals.wast:464 |
| 701 |
assert_malformed( |
| 702 |
() => instantiate(`(global f64 (f64.const 0x1._0)) `), |
| 703 |
`unknown operator`, |
| 704 |
); |
| 705 |
|
| 706 |
// ./test/core/float_literals.wast:468 |
| 707 |
assert_malformed( |
| 708 |
() => instantiate(`(global f64 (f64.const 0x_1p1)) `), |
| 709 |
`unknown operator`, |
| 710 |
); |
| 711 |
|
| 712 |
// ./test/core/float_literals.wast:472 |
| 713 |
assert_malformed( |
| 714 |
() => instantiate(`(global f64 (f64.const 0x1p1_)) `), |
| 715 |
`unknown operator`, |
| 716 |
); |
| 717 |
|
| 718 |
// ./test/core/float_literals.wast:476 |
| 719 |
assert_malformed( |
| 720 |
() => instantiate(`(global f64 (f64.const 0x1_p1)) `), |
| 721 |
`unknown operator`, |
| 722 |
); |
| 723 |
|
| 724 |
// ./test/core/float_literals.wast:480 |
| 725 |
assert_malformed( |
| 726 |
() => instantiate(`(global f64 (f64.const 0x1p_1)) `), |
| 727 |
`unknown operator`, |
| 728 |
); |
| 729 |
|
| 730 |
// ./test/core/float_literals.wast:484 |
| 731 |
assert_malformed( |
| 732 |
() => instantiate(`(global f64 (f64.const 0x_1.0p1)) `), |
| 733 |
`unknown operator`, |
| 734 |
); |
| 735 |
|
| 736 |
// ./test/core/float_literals.wast:488 |
| 737 |
assert_malformed( |
| 738 |
() => instantiate(`(global f64 (f64.const 0x1.0p1_)) `), |
| 739 |
`unknown operator`, |
| 740 |
); |
| 741 |
|
| 742 |
// ./test/core/float_literals.wast:492 |
| 743 |
assert_malformed( |
| 744 |
() => instantiate(`(global f64 (f64.const 0x1.0_p1)) `), |
| 745 |
`unknown operator`, |
| 746 |
); |
| 747 |
|
| 748 |
// ./test/core/float_literals.wast:496 |
| 749 |
assert_malformed( |
| 750 |
() => instantiate(`(global f64 (f64.const 0x1.0p_1)) `), |
| 751 |
`unknown operator`, |
| 752 |
); |
| 753 |
|
| 754 |
// ./test/core/float_literals.wast:500 |
| 755 |
assert_malformed( |
| 756 |
() => instantiate(`(global f64 (f64.const 0x1.0p+_1)) `), |
| 757 |
`unknown operator`, |
| 758 |
); |
| 759 |
|
| 760 |
// ./test/core/float_literals.wast:504 |
| 761 |
assert_malformed( |
| 762 |
() => instantiate(`(global f64 (f64.const 0x1.0p_+1)) `), |
| 763 |
`unknown operator`, |
| 764 |
); |