The MASM Forum

General => The Campus => Topic started by: deeR44 on April 28, 2022, 04:36:00 PM

Title: print floating point stuff with 'printf"?
Post by: deeR44 on April 28, 2022, 04:36:00 PM
Just starting to do floating point stuff. Where do I find printf stuff for that?

What's the difference between "printf" and "crt_printf"?
Title: Re: print floating point stuff with 'printf"?
Post by: jj2007 on April 28, 2022, 05:27:24 PM
Quote from: deeR44 on April 28, 2022, 04:36:00 PM
Just starting to do floating point stuff. Where do I find printf stuff for that?

On the web, all over the place

QuoteWhat's the difference between "printf" and "crt_printf"?

printf(...) is a macro
invoke crt_printf, ... behaves identically
Title: Re: print floating point stuff with 'printf"?
Post by: deeR44 on April 29, 2022, 06:48:46 AM
QuoteOn the web, all over the place

Well then, I'll keep looking.
Title: Re: print floating point stuff with 'printf"?
Post by: hutch-- on April 29, 2022, 09:26:35 AM
The C function "printf" is part of the C runtime library and as such, the reference you are looking for is with C documentation from a variety of sources, Microsoft, universities and online publications etc ....

It is by no means the only choice for displaying floating point to a console but as you have made that choice to use "printf", its C documentation you are looking for.
Title: Re: print floating point stuff with 'printf"?
Post by: deeR44 on April 29, 2022, 04:08:04 PM
Quoteyou have made that choice to use "printf", its C documentation you are looking for.
Thank you, Hutch.
Title: Re: print floating point stuff with 'printf"?
Post by: avcaballero on April 29, 2022, 05:35:54 PM
Writing a float number without using external libs, masm, fasm and nasm version

http://abreojosensamblador.epizy.com/?Tarea=1&SubTarea=20&Lang=1#EscribeFloat
Title: Re: print floating point stuff with 'printf"?
Post by: jj2007 on April 29, 2022, 06:33:42 PM
Quote from: caballero on April 29, 2022, 05:35:54 PM
Writing a float number without using external libs, masm, fasm and nasm version

http://abreojosensamblador.epizy.com/?Tarea=1&SubTarea=20&Lang=1#EscribeFloat

Looks good but is a bit difficult to find, therefore I attach your source :thumbsup:
Title: Re: print floating point stuff with 'printf"?
Post by: jack on April 30, 2022, 03:14:37 AM
is that your site caballero?
I attempted to write my own multi-precision floating-point math routines in FreeBasic and some of the more painfully difficult routines to implement were the conversion functions
it's easy if the number base is a power of 10 but it's a different story if the number base is a power of 2
what I wound up doing is to multiply or divide the mp-float by powers of 10 until you can start extracting decimal digits, it's rather slow but I am not motivated to pursue this any further
Title: Re: print floating point stuff with 'printf"?
Post by: avcaballero on April 30, 2022, 03:24:53 AM
> is that your site caballero?

Yes, it is. I made it on my own with php, including the forum, an example of using linked lists.
Title: Re: print floating point stuff with 'printf"?
Post by: jack on April 30, 2022, 03:27:58 AM
I like your site, I think it's well done  :smiley:
Title: Re: print floating point stuff with 'printf"?
Post by: avcaballero on April 30, 2022, 03:33:41 AM
 :thumbsup: Thank you. Just to learn Php a bit
Title: Re: print floating point stuff with 'printf"?
Post by: Gunther on April 30, 2022, 06:11:31 AM
Caballero,

your site is well done and the content is also good.
Title: Re: print floating point stuff with 'printf"?
Post by: avcaballero on April 30, 2022, 07:39:16 AM
 :thumbsup:
Title: Re: print floating point stuff with 'printf"?
Post by: NoCforMe on June 27, 2022, 12:13:39 PM
Is there a Win32 function that'll format floating-point values? I use wsprintf() all the time*, but it only handles integer values.

When I need printable representations of FP values, I use Raymond's library (specifically, FpFLtoA() ).

* I probably shouldn't be using this function, as it's not "safe" (can be used to hack code via buffer overruns), but since I'm not creating "production" code that anyone else is gonna use, it's not much of a problem ...
Title: Re: print floating point stuff with 'printf"?
Post by: Greenhorn on June 27, 2022, 05:00:50 PM
You may have a look at StringCchPrintf (https://docs.microsoft.com/en-us/windows/win32/api/strsafe/nf-strsafe-stringcchprintfw) or one of the function that it replaces.