完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我现在使用的是C32 V1.21编译器,我有一个项目,我必须使用长双倍。我很难找到任何来自C32 V1.21库的本地支持,将一个长的双转换为ASCII字符串,反之亦然。当需要从ASCII转换为long double时,但没有任何正式文档,我不能接受它作为一个可行的解决方案。有人遇到过支持长双倍的函数,并将其转换成一组ASCII字符,反之亦然?谢谢!
以上来自于百度翻译 以下为原文 Hi, I'm currently using the C32 v1.21 compiler and I've got a project where I have to use long doubles. I'm having difficulty finding any native support from the C32 v1.21 libraries to convert a long double to an ASCII string, and vice versa. I've come across the function _daof(), which seems to work when needing to convert from ASCII to long double, but without any official documentation on it I can't accept it as a viable solution. Has anyone come across functions which support take a long double and convert it to a string of ASCII characters, and vice versa? Thanks! |
|
相关推荐
8个回答
|
|
浮动/双到ASCII?通常*Prtff()执行这个技巧。不过,最好是检查文档,因为Micrchip有时是“特殊的”。
以上来自于百度翻译 以下为原文 float/double to ASCII? Usually *printf() does this trick. Though: better check the documentation as Micrchip is sometimes "special". |
|
|
|
长128倍?这是完全支持的吗?
以上来自于百度翻译 以下为原文 Long double as in 128 bits? Is that supported at all? |
|
|
|
XC32中的长双倍是一个64位浮点类型。尝试使用“%LF”格式说明符。SaveTFF():我不知道XC32是否有StrutDes()函数,试试看。;)
以上来自于百度翻译 以下为原文 A long double in XC32 is a 64-bit floating point type. Try sprintf() with "%Lf" format specifier. Edit: I don't know if XC32 has the strtold() function or not, try it and see. ;) |
|
|
|
在XC32 V1.21的文档中,long double被支持并且是64位宽的。我已经尝试了SaveTFF中的“%LF”格式说明符,但是没有实现期望的输出(在我的TFT上出现了字符串“LF”)。如果我记得正确的话,它们总是默认的,除非设置了编译器选项,否则不支持所有的说明符。
以上来自于百度翻译 以下为原文 In the documentation for XC32 v1.21 the long double is supported and is 64 bits wide. I have tried the "%Lf" format specifier in sprintf, but the desired output was not achieved (the string "Lf" appeared on my TFT). I'm wondering if there is an option for the compiler which enables full support of the printf/sprintf functions. If I remember correctly these are always by default in a mode where not all specifiers are supported unless a compiler option is set. |
|
|
|
64位也可以是正常的双。32位是单一的。启用64位双倍是编译器选项,默认为32位。我不知道如果长期超过这个。但不会有特殊的长双功能。A真的是加倍了。
以上来自于百度翻译 以下为原文 64 bits can also be a normal double. And 32 bits is a single. Enabling 64 bit doubles is a compiler option, they default to 32 bits. I do not know if long overrides this. But there will be no special long double functions. The a really just doubles. |
|
|
|
是的,我能够检查Sigeof(double)和sieof(浮点)是4,sisiof(long double)是8。我终于在32位语言工具库的第42页找到了Prtff()文档,说明它确实需要一个L说明符来将这个值转换成一个长的double。在SeaStand()文档中,它声明指定符与Prtff()相同。我想在这一点上,我必须拿出一张Microchip的票,看看他们的文档中是否有一个错误,SpaveTo()函数,或者两者都没有,我完全错过了一些东西。
以上来自于百度翻译 以下为原文 Yeah, I was able to check that sizeof(double) and sizeof(float) are 4, and sizeof(long double) is 8. I was finally able to find on page 42 of the 32-Bit Language Tools Libraries that the printf() documentation states it does take a L specifier to convert the value to a long double. In the sprint() documentation it states that it takes the specifiers the same as printf(). I guess at this point I'd have to take a ticket out with Microchip to see if there is an error in their documentation, the sprint() function, or perhaps neither and I'm totally missing something. |
|
|
|
在编译器选项中设置双打=64位的选项,只使用双打。编译器是基于GCC的。你也可以在GCC和长双倍网上搜索帮助。
以上来自于百度翻译 以下为原文 Set the option for doubles = 64 bits in the compiler options and just use doubles. The compiler is GCC based. You can also search the net for help on GCC and long doubles. |
|
|
|
我不知道C32编译器。但我知道,XC32有一些很长的历史,有长的双和STDIO函数。我可以想象,C32不会做得更好。对于XC32,它非常依赖于:编译器版本。-使用-FNO短双(双=64位而不是32位)。-使用遗留库(Microchip建议使用某些编译器版本)或不。-更多地得到一个印象,阅读发行说明,并在分页。“新的”、“固定的问题”和“已知的问题”部分:http://WW1. Microchip…com……所有发布No.HTML.例如:
以上来自于百度翻译 以下为原文 I don't know about the C32 compiler. But I know, the XC32 has some pretty dark history with long double and stdio functions. I could imagine, that the C32 doesn't do much better. For XC32 it is very much dependent on: - Compiler Version. - Use of -fno-short-double (double = 64 bit instead of 32 bit) or not. - Use of Legacy Library (which Microchip recommends to use since some certain compiler version) or not. - and more To get an impression read the release notes, and in particular the "What's New", the "Fixed Issues", and the "Known Issues" section: http://ww1.microchip.com/...all-release-notes.html For example: |
|
|
|
只有小组成员才能发言,加入小组>>
5231 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3200 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
771浏览 1评论
659浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
588浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
669浏览 0评论
571浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-19 11:06 , Processed in 1.488417 second(s), Total 92, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号