1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14.record panda.String <external> 15.record Convert <external> 16.function f64 Convert.stringToF64(panda.String a0) <external> 17 18.function i32 main(){ 19 # Convert.stringToF64("-1.0") == -1.0 20 lda.str "-1.0" 21 sta.obj v0 22 call Convert.stringToF64, v0 23 fmovi.64 v1, -1.0 24 fcmpg.64 v1 25 jnez exit_failure 26 27 # Convert.stringToF64("1.0") == 1.0 28 lda.str "1.0" 29 sta.obj v0 30 call Convert.stringToF64, v0 31 fmovi.64 v1, 1.0 32 fcmpg.64 v1 33 jnez exit_failure 34 35 ldai 0 36 return 37 38exit_failure: 39 ldai 1 40 return 41} 42