Replies: 1 comment 2 replies
-
Have a look at the Fmt interface in m3-libs/libm3/src/fmtlex/Fmt.i3.
Procedure Real formats a REAL into characters in several alternative
ways, I would guess Style.Fix, with prec as the desired number of
fractional digits, would probably be what you would want.
…On 3/30/23 23:20, Duke Normandin wrote:
Although the issue that I bring here has to do with Oberon-2 code, it could very easily be cm3 code. There seems to be a few mathematicians here so I thought I'd take the liberty and ask for directions here.
I wrote a simple temperature conversion utility - menu driven, C to F or F to C.
It works fine, but in Oberon-2, REALs are output in scientific notation only.
|Temperature Conversion Utility ------------------------------ 1 - Fahrenheit TO Celsius 2 - Celsius TO Fahrenheit - Enter your Choice 1 Enter a number/temperature TO convert: 32 Your input was 3.200000E+01 Fahrenheit! That's 0.000000E+00 In Celsius! |
Would any of you know of a way to convert the above output to a one decimal place REAL?
My goal is to port the code cm3 as a learning exercise, but I want to get my head around of how to tweak the above output to something a non math guru would understand. TIA!
—
Reply to this email directly, view it on GitHub <#1162>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABSVZNHVV3SFXH3NSNKOY7DW6ZLPFANCNFSM6AAAAAAWOEHNVY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Although the issue that I bring here has to do with Oberon-2 code, it could very easily be cm3 code. There seems to be a few mathematicians here so I thought I'd take the liberty and ask for directions here.
I wrote a simple temperature conversion utility - menu driven, C to F or F to C.
It works fine, but in Oberon-2, REALs are output in scientific notation only.
Would any of you know of a way to convert the above output to a one decimal place REAL?
My goal is to port the code cm3 as a learning exercise, but I want to get my head around of how to tweak the above output to something a non math guru would understand. TIA!
Beta Was this translation helpful? Give feedback.
All reactions