From f0c07b34fba0bd72bafe7b5d6848ef354d8d468a Mon Sep 17 00:00:00 2001 From: Dominic Orchard Date: Mon, 16 Sep 2024 15:29:21 +0100 Subject: [PATCH] extend case of exponentiation, but make failure be a pattern match issues for now --- src/Language/Fortran/Repr/Eval/Value.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Language/Fortran/Repr/Eval/Value.hs b/src/Language/Fortran/Repr/Eval/Value.hs index 09bfa0b1..a3407a75 100644 --- a/src/Language/Fortran/Repr/Eval/Value.hs +++ b/src/Language/Fortran/Repr/Eval/Value.hs @@ -273,10 +273,12 @@ evalBOp bop l r = do (FSVInt li, FSVInt ri) -> pure $ MkFScalarValue $ FSVInt $ fIntBOpInplace (^) li ri (FSVReal lr, FSVReal ri) -> - pure $ MkFScalarValue $ FSVReal $ fRealBOpInplace' exp exp lr ri - where - exp x y = x ** y - _ -> err $ ELazy "exponentiation: unsupported types" + pure $ MkFScalarValue $ FSVReal $ fRealBOpInplace' (**) (**) lr ri + (FSVReal lr, FSVInt ri) -> + -- Handle case of a real raised to an integer power. + pure $ MkFScalarValue $ FSVReal $ fRealBOpInplace' (**) (**) lr (FReal8 $ withFInt ri) + +-- _ -> err $ ELazy "exponentiation: unsupported types" F.Concatenation -> case (l', r') of